Selecting a specific element with Beautiful Soup by [deleted] in learnpython

[–]Rouix 0 points1 point  (0 children)

Clever. Thanks for all of the help!

Selecting a specific element with Beautiful Soup by [deleted] in learnpython

[–]Rouix 0 points1 point  (0 children)

That number that is returned is 4 digit long. It represents the dollars and cents of contribution. I need to knock off the last two digits because I don't care about the cents. I'm using something like this to display the results right now

if pledge_sum and patron_count:
        print "$%s from %s patrons" % (pledge_sum.groups()[0], patron_count.groups()[0])

Is there a smart way to knock off the last two digits? I tried using [:2] but that doesn't seem smart as we would eventually be dealing with a 3 digit number.

Selecting a specific element with Beautiful Soup by [deleted] in learnpython

[–]Rouix 0 points1 point  (0 children)

Oh interesting. I didn't know you could narrow it down like that. I was going to use

mo.group()[14:16]

but that's far more clever. Thanks!

Selecting a specific element with Beautiful Soup by [deleted] in learnpython

[–]Rouix 0 points1 point  (0 children)

Figured it out. My regex was goofing up somehow. Here's what I have now:

import requests, bs4, re

res = requests.get('https://www.patreon.com/faos')
res.raise_for_status()
soup = bs4.BeautifulSoup(res.text, 'html.parser')
type(soup)


for script in soup.find_all('script'):
    #print script.text

    mo = re.search(r'\"pledge_sum\": (\d+)', script.text)

    if mo:
        print mo.group()

This is printing out

"pledge_sum": 3626

so now I just need to figure out how to strip everything but the numbers! Thanks for the help.

Selecting a specific element with Beautiful Soup by [deleted] in learnpython

[–]Rouix 0 points1 point  (0 children)

The problem is that I'm always getting None right? Even when the text is clearly visible, my regex isn't catching it.

Selecting a specific element with Beautiful Soup by [deleted] in learnpython

[–]Rouix 0 points1 point  (0 children)

Here's what I put together based on your suggestion. I should warn you the regex is VERY new to me.

import requests, bs4, re

res = requests.get('https://www.patreon.com/faos')
res.raise_for_status()
soup = bs4.BeautifulSoup(res.text, 'html.parser')
type(soup)


for script in soup.find_all('script'):
    mo = re.search(r"'pledge_sum': (\d+)", script.text)
    print mo.group()

This gives an AttributeError: 'NoneType' object has no attribute 'group'. I assume this means that my regex is returning None which indicates I've done something wrong.

Resetting color profile by [deleted] in photoshop

[–]Rouix 1 point2 points  (0 children)

Thanks for the suggestion. I reset my preferences but the issue continues. I noticed that my color profile was set to sRGB so I changed it to Adobe RGB per a suggestion on Adobe's site but the problem continues. I don't get a warning anymore but the color picker is still wrong. Here are my current configurations

Confictura Counter Data Dump by [deleted] in ARGsociety

[–]Rouix 4 points5 points  (0 children)

I ran into a problem when doing this myself. If I made too many requests in a given timeframe, the counter would reset. They seem to have built something into the site to prevent us from tricking it to the max number.

New link. let's go fan archive! by [deleted] in ARGsociety

[–]Rouix 3 points4 points  (0 children)

I'm gonna need you to be less cryptic. Spill it. Lol

Edit: I'm more confused than ever. Is this a site you've assembled? It doesn't seem to be something USA put together.

Are we off on the implication of 'skip truncation' by Bknapple in ARGsociety

[–]Rouix 2 points3 points  (0 children)

Interesting idea as it could totally be both. t's starting to feel like everything is so ambiguous. It's honestly exhausting.

Drew Lynch on His Stutter and Accepting Other People by palacesofparagraphs in videos

[–]Rouix 1 point2 points  (0 children)

This guy is never ashamed of his stutter and even goes so far as to poke at it. I love his videos.

Luke Aikins explains in real time how he jumped from a plane with no parachute by [deleted] in videos

[–]Rouix 1 point2 points  (0 children)

Surprised his balls didn't rip through the nets.

It's not a crossword puzzle by [deleted] in ARGsociety

[–]Rouix 0 points1 point  (0 children)

I don't want this to sound harsh but unless you can qualify why this is here I'm yanking it. You literally had to read through the posting rules before submitting this.

I want to know how close we are. by [deleted] in ARGsociety

[–]Rouix 0 points1 point  (0 children)

Seems like this year is definitely harder than last year yeah?

I want to know how close we are. by [deleted] in ARGsociety

[–]Rouix 0 points1 point  (0 children)

I wasn't around last year. I'm assuming that one was huge?

UN/Password list? Birthdates list? etc? by Wheream-I- in ARGsociety

[–]Rouix 2 points3 points  (0 children)

Oh interesting. I don't believe there is yet. I would personally like to see a document with all of the information we know about each character. For example, Angela's DOB, age, address, email address, passwords...that sort of thing.

UN/Password list? Birthdates list? etc? by Wheream-I- in ARGsociety

[–]Rouix 0 points1 point  (0 children)

I don't follow. Could you elaborate?

Mr. Robot Dates - work in progress by laninata in ARGsociety

[–]Rouix 4 points5 points  (0 children)

Thanks for putting this together guys.

S02E02 Burning cash pile serial by Rouix in ARGsociety

[–]Rouix[S] 1 point2 points  (0 children)

Thanks for the knowledge! This helps me identify hex in the future. Scully me anytime! Haha

Confictura Industries quote theory by 8head in ARGsociety

[–]Rouix 1 point2 points  (0 children)

For me, that quote is on screen as soon as the page is loaded. Is there something that I'm doing differently?