Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas as pd
- from pandas import json_normalize
- count = 0
- url_base = 'https://store.steampowered.com/appreviews/393380?json=1&cursor='
- #36734
- #first pass
- url = urllib.request.urlopen("https://store.steampowered.com/appreviews/393380?json=1&cursor=*")
- data = json.loads(url.read().decode())
- next_cursor = data['cursor']
- df1 = json_normalize(data['reviews'])
- count += 20
- print(next_cursor)
- print(count)
- #next pass
- url_temp = url_base+next_cursor
- url = urllib.request.urlopen(url_temp)
- data = json.loads(url.read().decode())
- next_cursor = data['cursor']
- df2 = json_normalize(data['reviews'])
- df1 = pd.concat([df1, df2])
- count += 20
- print(next_cursor)
- print(count)
- #next pass
- url_temp = url_base+next_cursor
- url = urllib.request.urlopen(url_temp)
- data = json.loads(url.read().decode())
- next_cursor = data['cursor']
- df2 = json_normalize(data['reviews'])
- df1 = pd.concat([df1, df2])
- count += 20
- print(next_cursor)
- print(count)
- #next pass
- url_temp = url_base+next_cursor
- url = urllib.request.urlopen(url_temp)
- data = json.loads(url.read().decode())
- next_cursor = data['cursor']
- df2 = json_normalize(data['reviews'])
- df1 = pd.concat([df1, df2])
- count += 20
- print(next_cursor)
- print(count)
- #next pass
- url_temp = url_base+next_cursor
- url = urllib.request.urlopen(url_temp)
- data = json.loads(url.read().decode())
- next_cursor = data['cursor']
- df2 = json_normalize(data['reviews'])
- df1 = pd.concat([df1, df2])
- count += 20
- print(next_cursor)
- print(count)
- #next pass
- url_temp = url_base+next_cursor
- url = urllib.request.urlopen(url_temp)
- data = json.loads(url.read().decode())
- next_cursor = data['cursor']
- df2 = json_normalize(data['reviews'])
- df1 = pd.concat([df1, df2])
- count += 20
- print(next_cursor)
- print(count)
- #next pass
- url_temp = url_base+next_cursor
- url = urllib.request.urlopen(url_temp)
- data = json.loads(url.read().decode())
- next_cursor = data['cursor']
- df2 = json_normalize(data['reviews'])
- df1 = pd.concat([df1, df2])
- count += 20
- print(next_cursor)
- print(count)
- #send df to csv
- df1.to_csv('file_name.csv')
Add Comment
Please, Sign In to add comment