def get_session():
session = requests.Session()
session.headers = {
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0',
'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language':'ru,en-US;q=0.5',
'Accept-Encoding':'gzip, deflate, br',
'DNT':'1',
'Connection':'keep-alive',
'Upgrade-Insecure-Requests':'1',
'Pragma':'no-cache',
'Cache-Control':'no-cache'}
return cfscrape.create_scraper(sess=session)
session = get_session() # Дальше работать как с обычной requests.Session
import requests
import cfscrape
def get_session():
session = requests.Session()
session.headers = {
'Host':'www.artstation.com',
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0',
'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language':'ru,en-US;q=0.5',
'Accept-Encoding':'gzip, deflate, br',
'DNT':'1',
'Connection':'keep-alive',
'Upgrade-Insecure-Requests':'1',
'Pragma':'no-cache',
'Cache-Control':'no-cache'}
return cfscrape.create_scraper(sess=session)
def artstation():
url = 'https://www.artstation.com/kyuyongeom'
page_url = 'https://www.artstation.com/users/kyuyongeom/projects.json'
post_pattern = 'https://www.artstation.com/projects/{}.json'
session = get_session()
absolute_links = []
response = session.get(page_url, params={'page':1}).json()
pages, modulo = divmod(response['total_count'], 50)
if modulo: pages += 1
for page in range(1, pages+1):
if page != 1:
response = session.get(page_url, params={'page':page}).json()
for post in response['data']:
shortcode = post['permalink'].split('/')[-1]
inner_resp = session.get(post_pattern.format(shortcode)).json()
for img in inner_resp['assets']:
if img['asset_type'] == 'image':
absolute_links.append(img['image_url'])
with open('links.txt', 'w') as file:
file.write('\n'.join(absolute_links))
if __name__ == '__main__':
artstation()
самый простой способ решения
v0 = input('Value 1: ')
v1 = input('Value 2: ')
if (v0 + v1).isdigit():
new_value = str(int(v0) + int(v1))
else:
new_value = v0 + v1
print(v0 + new_value + v1)
user_id = id жертвы
profile_pic = session.get(f'https://i.instagram.com/api/v1/users/{user_id}/info/').json()
pic_id = int(profile_pic['user']['profile_pic_id'].split('_')[0])
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'
def id_to_code(media_id):
shortcode = ''
while media_id > 0:
tail = media_id % 64
media_id = (media_id - tail) // 64
shortcode = alphabet[tail] + shortcode
return shortcode
shortcode = id_to_code(pic_id)
import requests
from bs4 import BeautifulSoup
import json
load_url = 'https://www.biz-cen.ru/load/'
search_params = {"metro":{"lines":{}},"was_ra":",","limit":20,"to_ra":0,"tolim":20,"bc_in_fav":[],"office_in_fav":[],"bcs_in_view_start":[],"num_in":3,"typeof_search":5,"show_fav":0}
data = {'search_params':json.dumps(search_params), 'was_bc_loaded':0}
session = requests.Session()
seen = set()
def parse(response):
soup = BeautifulSoup(response.text, 'lxml')
table = soup.find('ul', id='bObjDataList')
if table:
lis = table.find_all('li')
else:
lis = soup.find_all('li')
return [i.find('a').get('href') for i in lis]
while len(seen) < 200:
response = session.post(load_url, data=data)
for link in parse(response):
seen.add(link)
search_params['limit'] += 20
data['search_params'] = json.dumps(search_params)
print(len(seen))
Подскажите плиз как распечатать значение tittle= в коде ниже со странички по ссылке?
tag.get('title')