Skip to content

Instantly share code, notes, and snippets.

@Core-commits
Created July 4, 2020 20:26
Show Gist options
  • Save Core-commits/d7d6d67a4c9b965b3128447e130a0977 to your computer and use it in GitHub Desktop.
Save Core-commits/d7d6d67a4c9b965b3128447e130a0977 to your computer and use it in GitHub Desktop.
from bs4 import BeautifulSoup
import requests as r
import json
import re
def GetPost(url): # Get Post Text Title.
HTML1 = r.get(url).text
soup = BeautifulSoup(HTML1, 'html.parser')
code = soup.span.get_text()
return code
def GetPostURL(url):# Get post url
HTML1 = r.get(url).text
soup = BeautifulSoup(HTML1, 'html.parser')
code2= soup.find("a", href=True)
return code2
code = GetPost("https://www.brick-hill.com/forum/14")
while True:
ncode = GetPost("https://www.brick-hill.com/forum/14")
postlink = GetPostURL("https://www.brick-hill.com/forum/14")
if ncode != code:
url = ""
data = {}
data["content"] = "New Creations Subforum Post!"
data["username"] = "EdgedFeed"
data["embeds"] = []
embed = {}
embed["title"] = ""
embed["description"] = ncode + "\n"+"https://brick-hill.com"+postlink['href=/forum/']
data["embeds"].append(embed)
result = r.post(url, data=json.dumps(data), headers={"Content-Type": "application/json"})
code = ncode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment