-
-
Save avevlad/7256c6854e6b5bc55809 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
class Parser: | |
def __init__(self): | |
self.fl() | |
def fl(self): | |
payload = { | |
'action': 'postfilter', | |
'pf_pro_only': '1' | |
} | |
r = requests.post("https://www.fl.ru/projects/", data=payload) | |
html_parse = BeautifulSoup(r.text) | |
for post_item in html_parse.findAll("div", {"class": "b-post"}): | |
data = self.getPostInfo(post_item) | |
self.setDb(data) | |
def getPostInfo(self, post_item): | |
post_href = post_item.find("a", {"class": "b-post__link"}) | |
post_title = post_href.text | |
post_link = post_href["href"] | |
post_ld = post_link.split("/")[2] | |
return ( | |
post_ld, | |
post_title, | |
post_link | |
) | |
def setDb(self, data): | |
print(data) | |
dog = Parser() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
python 😕 python