D
On the contrary...I've been active on forum recently, that might be the reason for the growth![]()
I actually also have the graphs for each member as well as a whole host of other stuff like the average number of thanks per post, average thread replies within one month, average message length, post rate per sub-forum etc. etc. etc. But I felt that this thread made more sense with just two (now three) graphs.Yeah but Proxygo is a member here, so.
I'm interested in knowing this myself.Interesting. What's the source of this data?
Interesting. What's the source of this data?
I'm interested in knowing this myself.
import urllib2
from bs4 import BeautifulSoup
import csv
n=100
m=108259 # Total number of posts / n. For example, 10825900/100 = 108259.
id_list = range(0, (m+1)*n, n)[1:]
i = 99080
while i < len(id_list):
current_id = id_list[99080]
web_page = "https://blackhatworld.com/posts/"
post_id = current_id
full_url = web_page + str(post_id)
print full_url
#Try to open page
try:
page = urllib2.urlopen(full_url)
soup = BeautifulSoup(page, 'html.parser')
li_post_id = "post-" + str(post_id)
li_soup = soup.find('li', attrs={'id':li_post_id})
div1_soup = li_soup.find(attrs={'class':'DateTime'})
s1 = div1_soup
l = s1['title']
print(current_id)
print("")
print(l + str(current_id))
with open('date_and_id.csv', 'a') as csv_file:
writer = csv.writer(csv_file)
writer.writerow([l, current_id])
del id_list[99079]
print len(id_list)
# Response for 404 or 403
except urllib2.HTTPError as e:
if e.getcode() == 404: # check return code
div1_soup = "missing"
print(current_id)
print("")
print(div1_soup + str(current_id))
with open('date_and_id.csv', 'a') as csv_file:
writer = csv.writer(csv_file)
writer.writerow([div1_soup, current_id])
del id_list[0]
print len(id_list)
if e.getcode() == 403: # check return code
div1_soup = "403"
print(current_id)
print("")
print(div1_soup + str(current_id))
with open('date_and_id.csv', 'a') as csv_file:
writer = csv.writer(csv_file)
writer.writerow([div1_soup, current_id])
del id_list[99079]
print len(id_list)
I am.
Code:import urllib2 from bs4 import BeautifulSoup import csv n=100 m=108259 # Total number of posts / n. For example, 10825900/100 = 108259. id_list = range(0, (m+1)*n, n)[1:] i = 99080 while i < len(id_list): current_id = id_list[99080] web_page = "https://blackhatworld.com/posts/" post_id = current_id full_url = web_page + str(post_id) print full_url #Try to open page try: page = urllib2.urlopen(full_url) soup = BeautifulSoup(page, 'html.parser') li_post_id = "post-" + str(post_id) li_soup = soup.find('li', attrs={'id':li_post_id}) div1_soup = li_soup.find(attrs={'class':'DateTime'}) s1 = div1_soup l = s1['title'] print(current_id) print("") print(l + str(current_id)) with open('date_and_id.csv', 'a') as csv_file: writer = csv.writer(csv_file) writer.writerow([l, current_id]) del id_list[99079] print len(id_list) # Response for 404 or 403 except urllib2.HTTPError as e: if e.getcode() == 404: # check return code div1_soup = "missing" print(current_id) print("") print(div1_soup + str(current_id)) with open('date_and_id.csv', 'a') as csv_file: writer = csv.writer(csv_file) writer.writerow([div1_soup, current_id]) del id_list[0] print len(id_list) if e.getcode() == 403: # check return code div1_soup = "403" print(current_id) print("") print(div1_soup + str(current_id)) with open('date_and_id.csv', 'a') as csv_file: writer = csv.writer(csv_file) writer.writerow([div1_soup, current_id]) del id_list[99079] print len(id_list)
I am.
Code:import urllib2 from bs4 import BeautifulSoup import csv n=100 m=108259 # Total number of posts / n. For example, 10825900/100 = 108259. id_list = range(0, (m+1)*n, n)[1:] i = 99080 while i < len(id_list): current_id = id_list[99080] web_page = "https://blackhatworld.com/posts/" post_id = current_id full_url = web_page + str(post_id) print full_url #Try to open page try: page = urllib2.urlopen(full_url) soup = BeautifulSoup(page, 'html.parser') li_post_id = "post-" + str(post_id) li_soup = soup.find('li', attrs={'id':li_post_id}) div1_soup = li_soup.find(attrs={'class':'DateTime'}) s1 = div1_soup l = s1['title'] print(current_id) print("") print(l + str(current_id)) with open('date_and_id.csv', 'a') as csv_file: writer = csv.writer(csv_file) writer.writerow([l, current_id]) del id_list[99079] print len(id_list) # Response for 404 or 403 except urllib2.HTTPError as e: if e.getcode() == 404: # check return code div1_soup = "missing" print(current_id) print("") print(div1_soup + str(current_id)) with open('date_and_id.csv', 'a') as csv_file: writer = csv.writer(csv_file) writer.writerow([div1_soup, current_id]) del id_list[0] print len(id_list) if e.getcode() == 403: # check return code div1_soup = "403" print(current_id) print("") print(div1_soup + str(current_id)) with open('date_and_id.csv', 'a') as csv_file: writer = csv.writer(csv_file) writer.writerow([div1_soup, current_id]) del id_list[99079] print len(id_list)
One in every 100 posts, didn’t take that long. No need for any hacked stuff, it’s all publicly available information, if you know where to look.You crawled the whole site? I bet that took ages or have I read this wrong and it is just scraping a few stats pages?
Either way I am impressed and relieved it is not from a hacked DB.
That’s one of my first drafts - just something I had on the closest laptop to me. It starts scraping from some random post near the end because I was testing the scripts’s ability to restart where it left off.Stealed
Seems to be implicitly allowed via the site's robots.txt file.Did you ask permission to crawl the site OP?
User-agent: *
Disallow: /members/
User-agent: Fasterfox
Disallow: /
Sitemap: https://www.blackhatworld.com/sitemap.php
Permission? It’s part of a large-scale SE project I’m working on. Last time I checked web crawling was allowed, as @MatthewGraham pointed out.Did you ask permission to crawl the site OP?
Seems to be implicitly allowed via the site's robots.txt file.
https://www.blackhatworld.com/robots.txt
Code:User-agent: * Disallow: /members/ User-agent: Fasterfox Disallow: / Sitemap: https://www.blackhatworld.com/sitemap.php
Permission? It’s part of a large-scale SE project I’m working on. Last time I checked web crawling was allowed, as @MatthewGraham pointed out.
It was more of a courtesy thin
I was testing the scripts’s ability to restart where it left off.
That's some interesting data. Perhaps the fact that IM/DM is getting harder and harder has left people dropping out of the game?