[python] get dict from html

Messages
660
Reaction score
549
Points
600
hi, im trying to get my SteamID64(76561198838542766) and persona name(ray) from a dictionary in html, can be seen here: i just dont know how to do it, i know i can make an xml parser and get all of the info from here: https://steamcommunity.com/id/tai/?xml=1
but i feel like challenging myself a little
let me know if u got a solution for me

NOTE: I'm using requests and bs4.
 
Messages
154
Reaction score
410
Points
460
Location
Portugal
I see where you're getting at with dictionaries, but those only exist in python. in most languages, they are called associative arrays. That however is a json object. Im sure there's a library out there to parse json in python. If you want a challenge, you should make that parser yourself. Get the json as a string and then using string utils make a parser that transforms it into a dictionary.
 
Messages
660
Reaction score
549
Points
600
I see where you're getting at with dictionaries, but those only exist in python. in most languages, they are called associative arrays. That however is a json object. Im sure there's a library out there to parse json in python. If you want a challenge, you should make that parser yourself. Get the json as a string and then using string utils make a parser that transforms it into a dictionary.
i mean yeah thats obvious but in python its called a dictionary so im already used to it, havent touched any other programming language in a couple of months(like c, c#, c++ or java)

and i think that i can get that certain info and just cast it into a dictionary or something no? ;;
 
Messages
154
Reaction score
410
Points
460
Location
Portugal
I understand. I thought you wanted more of challenge xD

Well u can use the builtin module called json

Python:
import json

object_string = '{'id': 1, 'name': 'sexy', 'race': 'penguin'}' # fetch this from the dom
object_json = json.loads(object_string) # returns a parsed dict
 
Messages
660
Reaction score
549
Points
600
I understand. I thought you wanted more of challenge xD

Well u can use the builtin module called json

Python:
import json

object_string = '{'id': 1, 'name': 'sexy', 'race': 'penguin'}' # fetch this from the dom
object_json = json.loads(object_string) # returns a parsed dict
i dont think u get me
i dont know how to get the info with beautifulsoup,
im using requests to get the website and beautifulsoup to get specific info that i want
for an example, this code gets the username from steam's html code and print it out to the console(you can change the profile link to get anyone else's name, most basic shit ever):
Python:
import requests
from bs4 import BeautifulSoup

html = requests.get("https://steamcommunity.com/id/tai").text # this line of code gets the html, try to print it out to the console if you didnt get what i meant
soup = BeautifulSoup(html, 'lxml')
steam_name = soup.find('span', {'class': 'actual_persona_name'}).get_text()
print(steam_name)
 
Messages
660
Reaction score
549
Points
600
ill try to explain it in a better way, i need to get json that is stored at a script tag,
go to this link https://steamcommunity.com/id/tai
press ctrl + shift + i and then ctrl + f
type this in the search field "g_rgProfileData", i want to grab this data so i can print it out to the console when going through 5+ profiles.
 
Messages
660
Reaction score
549
Points
600
Ive spent 5 minutes reading this thread. How is any of this fun?
have you ever thought of making your own perp server or just a darkrp server? once you actually get into it and you start realizing that you need to sit down, learn how to code just to edit a simple thing like the amount of money that u get per hour or minute or w/e, because there's no panel.
at first it might be pretty boring for you or it might not be for you because youre used to having a panel that does everything for you.
i like coding its really fun for me because i can make a shitton of useful tools for steam or for my cracking stuff, bots for discord or just bots that go into certain websites, register and start to spam the fuck out of the forum

and you can make a lot of money, for an example: you made a program that exploits steam, you report it to steam and get from $100 - $5,000(around that). easy money innit?
 

Daigestive

Professional Stripper
Messages
3,703
Reaction score
8,006
Points
395
Location
Palestine
have you ever thought of making your own perp server or just a darkrp server? once you actually get into it and you start realizing that you need to sit down, learn how to code just to edit a simple thing like the amount of money that u get per hour or minute or w/e, because there's no panel.
at first it might be pretty boring for you or it might not be for you because youre used to having a panel that does everything for you.
i like coding its really fun for me because i can make a shitton of useful tools for steam or for my cracking stuff, bots for discord or just bots that go into certain websites, register and start to spam the fuck out of the forum

and you can make a lot of money, for an example: you made a program that exploits steam, you report it to steam and get from $100 - $5,000(around that). easy money innit?
This is what Permaban does to you lmao. None of this would be in my interest.
 
Messages
660
Reaction score
549
Points
600
This is what Permaban does to you lmao. None of this would be in my interest.
while i was growing i was learning how to code and made tools, has nothing to do with my ban.
 
Top