sunsexsurf

vfbank_get_id

Apr 12th, 2020
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. import requests
  2. from bs4 import BeautifulSoup
  3.  
  4. headers = {'user-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:72.0) Gecko/20100101 Firefox/72.0',
  5.       'BX-ACTION-TYPE':'get_dynamic',
  6.       'BX-CACHE-MODE':'HTMLCACHE',
  7. }
  8.  
  9. url = 'https://www.vfbank.ru/fizicheskim-licam/monety/pamyatnye-monety/'
  10.  
  11. def parsing(html):
  12.   start = html.find('bxdynamic_moneti_inner')
  13.   end = html.find("'HASH':'844584f9f4f7',")
  14.  
  15.   data = html[start:end].replace('\\n','').replace('\\','')
  16.  
  17.   soup = BeautifulSoup(data,"html.parser")
  18.   coins = soup.find_all('div',class_='col col--lg-6')
  19.   for coin in coins:
  20.     title = coin.find('a').text.strip()
  21.     _id = coin.find('a').get('data-id')
  22.     print(title,_id)
  23.  
  24. response = requests.get(url,headers=headers)
  25. parsing(response.text)
Add Comment
Please, Sign In to add comment