Note: I am very much an amateur, but the code below outputs raw postcounts of all your posts on the first page of that thread.
Code:
36956233
36962774
36972076
36994108
37115053
I was confused at first, because there are 25 of your posts on the first page, not only the 5 which the script outputs. But that's for me, logged into 2p2, viewing the forum at 100ppp. Your script will not be logged in and thus only view 25ppp. So it only finds 5 of your posts.
You'll have to cycle through the pages, and then append all the raw postnumbers to the url to scrape all your posts from that thread.
Code:
#!/usr/bin/env python3
import requests
from bs4 import BeautifulSoup
url = "https://forumserver.twoplustwo.com/174/poker-goals-amp-challenges/d7s-2013-pgc-100k-moving-up-1295523/"
user_id = "230247"
r = requests.get(url)
soup = BeautifulSoup(r.text, "html.parser")
myPosts = []
for user in soup.find_all("a", {"class" : "bigusername"}):
if user_id in user["href"]:
myPosts.append(user.parent["id"].split("_")[-1])
for post in myPosts:
print(post)
If the for-loop confuses you (especially the last line), here's what it does:
We've stored all "a" tags that are of class : "bigusername" in a temporary variable called "user".
We check if it's you (230247)
Then, to get only the raw post numbers, we go to this tag's parent, which looks like this:
Code:
<div id="postmenu_xxxxxxxx">
We take its id tag, split it into a list separated at the underscore, and then take this list's last item ([-1]) to append to our list "myPosts".
A final tip: Don't hardcode "url" and "user_id". Use sys.argv instead. You never know when you might want to scrape another thread, or another user's posts.