Skip to content

Instantly share code, notes, and snippets.

View Aubreymcfato's full-sized avatar

Andrea Aubreymcfato

View GitHub Profile
@Aubreymcfato
Aubreymcfato / enws_scraper.py
Created July 14, 2016 14:34
Python script for the English Wikisource: it scrapes ns0 books, getting all the metadata, and also other metadata from the Index page.
import requests
from bs4 import BeautifulSoup
import unicodecsv
import re
#uses unicodecsv for generating a CSV. I'm using python 2.7
#if you use Python 3.X, go with "csv" and change the related instructions accordingly.
#Beware of
# csv.writer(open("FILE.csv"), "wt")
@Aubreymcfato
Aubreymcfato / itws_scraper.py
Created July 14, 2016 13:59
Python script for the Italian Wikisource: it scrapes ns0 books, getting all the metadata, and also the cover URL from the Index page.
#!/usr/bin/env python
import requests
from bs4 import BeautifulSoup
import unicodecsv
#uses unicodecsv for generating a CSV. I'm using python 2.7
#if you use Python 3.X, go with "csv" and change the related instructions accordingly.
#Beware of
# csv.writer(open("FILE.csv"), "wt")
@Aubreymcfato
Aubreymcfato / 2015_books-pub+aut+tit.html
Created January 2, 2016 14:28
Grafico per post: editore - autore - titolo
<svg xmlns="http://www.w3.org/2000/svg" height="800" width="848"><g transform="translate(40,0)"><path d="M0,441.6666666666667C114.66666666666666,441.6666666666667 114.66666666666666,90 229.33333333333331,90" style="fill: none; stroke: rgb(204, 204, 204); stroke-width: 1px;" class="link"></path><path d="M0,441.6666666666667C114.66666666666666,441.6666666666667 114.66666666666666,200 229.33333333333331,200" style="fill: none; stroke: rgb(204, 204, 204); stroke-width: 1px;" class="link"></path><path d="M0,441.6666666666667C114.66666666666666,441.6666666666667 114.66666666666666,226.66666666666666 229.33333333333331,226.66666666666666" style="fill: none; stroke: rgb(204, 204, 204); stroke-width: 1px;" class="link"></path><path d="M0,441.6666666666667C114.66666666666666,441.6666666666667 114.66666666666666,240 229.33333333333331,240" style="fill: none; stroke: rgb(204, 204, 204); stroke-width: 1px;" class="link"></path><path d="M0,441.6666666666667C114.66666666666666,441.6666666666667 114.66666666666666,253.333333
@Aubreymcfato
Aubreymcfato / url_checker.py
Created September 4, 2015 10:29
Script for checking is a URL exists or is a dead link.
import requests
def exists(url):
r = requests.get(url)
print r.status_code
"""
if r.status_code == 200: #requests.codes.ok:
print "daje"
else:
print None
@Aubreymcfato
Aubreymcfato / wikisource_contest.py
Last active August 16, 2016 15:59
Wikisource page counter for contest. It is used during the annual contest in Wikisource to track and cound editors proofreadings.
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2013 Joan Creus <joan.creus.c@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights