Skip to content

Instantly share code, notes, and snippets.

Created April 4, 2014 07:31
What would you like to do?
Получает с гифки с кол-вом просмотров и выдает в stdout в виде csv
from bs4 import BeautifulSoup
from urllib2 import urlopen
from urlparse import urljoin
import re
for num in range(1, 150):
url = "" + str(num)
res = urlopen(url)
soup = BeautifulSoup(
links ='td a')
for link in links:
page_url = urljoin(url, link.attrs['href'])
page_res = urlopen(page_url)
page_soup = BeautifulSoup(
views ='div.image-date')[0].text
views_int = int(re.findall(r'\d+', views)[0])
img_src = urljoin(page_url,'img')[0].attrs['src'])
print str(views_int) + "," + img_src
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment