Skip to content

Instantly share code, notes, and snippets.

@avevlad
Forked from anonymous/parse.py
Created Jul 24, 2014
Embed
What would you like to do?
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()
@avevlad

This comment has been minimized.

Copy link
Owner Author

@avevlad avevlad commented Aug 1, 2014

python 😕 python

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment