Last active
September 20, 2015 16:06
-
-
Save girishramnani/61c5f36b604783062cd2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import bs4 | |
import requests | |
from itertools import count | |
def get_unlimited(link): | |
for i in count(1): | |
response = requests.get("{}&page={}".format(link,i)) | |
yield response.content.decode() | |
link = sys.argv[1] | |
print(link) | |
past_attr="Nothing" | |
for content in get_unlimited(link): | |
soup = bs4.BeautifulSoup(content) | |
attr = soup.find("span","mb-timestamp") | |
if not attr: | |
break | |
past_attr = attr | |
print(past_attr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
usage
better use the
"
in the link or else in some link the whole link wouldnt be taken in.NOTE - if you have
lxml
installed then just change the lineto
as you know
lxml
is faster.