Retrieving ad URLs

2024/10/16 3:26:53

I'm looking for a way to retrieve the ad URLs for this website. http://www.quiltingboard.com/resources/

What I want to do is probably write a script to continuously refresh the page and grab the ad URLs.

Any suggestion?

Answer

BeautifulSoup alone isn't going to cut it. The ads are injected via javascript ( they're doubleclick ads ).

Your options are:

  • script something like selenium to look for the urls 10-15seconds after page load
  • if you stay in pure python, you'll need to :

    1. make the initial request to parse with beautiful soup
    2. figure out what google was going to inject with javascript
    3. make a secondary request to doubleclick for the iframe or payload url

Those methods will only get you the doubleclick urls that handle conversion tracking. If you want to find out where they redirect to, you'll need to open those urls to discover their redirects.

https://en.xdnf.cn/q/117757.html

Related Q&A

Extract data (likes) from JSON API using Python

I want to pull the number of likes for my project. Heres my code: import facepy from facepy import GraphAPI from bs4 import BeautifulSoup import json access = CAACEdEose0cBAE3IL99IreDeAfqaVZBOje8ZCqIhf…

No nested nodes. How to get one piece of information and then to get additional info respectively?

For the code below I need to get dates and their times+hrefs+formats+...(not shown) respectively.<div class="showtimes"><h2>The Little Prince</h2><div class="poster&…

I need help changing the color of text in python

Hey I need help with coloring the text in a program I am making. It is a password program and I am trying to make the denied and granted red and green when they appear. Here is the program so far:passw…

How do I use Liclipse to write a ParaView script?

Ive tried following the directions here without success. Here are some of my environment variables:Path: C:\Python34\;C:\Python34\Scripts;...;C:\Program Files (x86)\ParaView 4.3.1\lib\paraview-4.3\site…

List of tuples to nested dictionary without overriding

I need to convert the above list of tuples to nested dictionary without overwriting the value as below in python[(a, 1),(b, true),(b, none),(a, 2),(b, true),(a, 3),(b, false)]{a: {1 : { b : (true,none)…

Rotate matplotlib pyplot with curve by 90 degrees

I have plot with one line as this:import numpy as np import matplotlib.pyplot as pla = np.array([4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9]) b = np.array([i/len(a) for i in range(1,…

Reading csv file and returning as dictionary

Ive written a function that currently reads a file correctly but there are a couple of problems. It needs to be returned as a dictionary where the keys are artist names and the values are lists of tupl…

Spark converting Pandas df to S3

Currently i am using Spark along with Pandas framework. How can I convert Pandas Dataframe in a convenient way which can be written to s3. I have tried below option but I get error as df is Pandas dat…

install jupyter notebook in windows

My Python version is 3.6.0 and my operating system is Windows. I want to install jupyter notebook using the order pip install jupyter. But it failed, I got the following error:

Play a sound using python subprocess and threading

I am trying to open an alert, then loop a sound until the alert is closed. Then the sound should stop.I tried this:import threading import time import subprocessstop_sound = False def play_alarm(file_n…