Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import json
- import requests
- target_url = 'https://guest.api.arcadia.pinnacle.com/0.1/matchups/{}/related'
- target_link = 'https://guest.api.arcadia.pinnacle.com/0.1/matchups/{}/markets/related/straight'
- def get_matchup_ids():
- link = 'https://guest.api.arcadia.pinnacle.com/0.1/sports/12/matchups/highlighted'
- res = requests.get(link,headers={'User-Agent':'Mozilla/5.0','content-type': 'application/json','X-API-Key': "CmX2KcMrXuFmNg6YFbmTxE0y9CIrOi0R"})
- for item in res.json():
- yield item['id']
- def get_results(id_num):
- res = requests.get(target_url.format(id_num),headers={'User-Agent':'Mozilla/5.0','content-type': 'application/json','X-API-Key': "CmX2KcMrXuFmNg6YFbmTxE0y9CIrOi0R"})
- json_content = res.json()
- for item in json_content:
- first,second,amount = get_info(item['id'])
- name_n_contact = item['league']['name']
- name = name_n_contact.split("-")[0].strip()
- company = name_n_contact.split("-")[1].strip()
- contestant_one = item['participants'][0]['name']
- contestant_two = item['participants'][1]['name']
- print(item['id'],name,company,contestant_one,contestant_two,first,second,amount)
- def get_info(id_num):
- res = requests.get(target_link.format(id_num),headers={'User-Agent':'Mozilla/5.0','content-type': 'application/json','X-API-Key': "CmX2KcMrXuFmNg6YFbmTxE0y9CIrOi0R"})
- for item in res.json():
- if id_num!=item['matchupId']: continue
- first = item['prices'][0]['price']
- second = item['prices'][1]['price']
- amount = item['limits'][0]['amount']
- return first,second,amount
- if __name__ == '__main__':
- for item_id in get_matchup_ids():
- get_results(item_id)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement