blob: b6d0a3488685d23242295d507cfd1f6a6d7535eb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
import urllib
from bs4 import BeautifulSoup as bs
class RemoteUrl:
url_cache = {}
@classmethod
def fetch(cls, url):
if url not in cls.url_cache:
cls.url_cache[url] = urllib.urlopen(url).read()
return bs(cls.url_cache[url], 'lxml')
|