Created
March 11, 2013 02:51
-
-
Save danneu/5131596 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 lxml import html | |
res = requests.get('http://www.example.com') | |
doc = html.fromstring(res.text) | |
el = doc.cssselect('#id.class') |
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
require "open-uri" | |
require "nokogiri" # 3rd party html parsing lib | |
html = open("http://www.example.com") | |
doc = Nokogiri::HTML(html) | |
el = doc.at("#id.class") |
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
(ns crawler.core | |
(:require [net.cgrand.enlive-html :as enlive]) | |
(:import [java.net.URL])) | |
(def nodes | |
(enlive/html-resource | |
(java.net.URL. "http://www.example.com"))) | |
(def el | |
(enlive/select nodes | |
[:#id.class])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment