日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

读取Webpage表中的内容

發布時間:2024/1/23 编程问答 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 读取Webpage表中的内容 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.



??? nutch將從網頁中抓取到的信息放入hbase數據庫中,默認情況下表名為$crawlId_webpage,但表中的內容以16進制進行表示,直接scan或者通過Java API進行讀取均只能讀取到16進制信息。
??? 因此nutch提供了readdb選項進行數據獲取,將表中的內容讀取到一個文本中。

?具體用法為:

$ bin/nutch readdb Usage: WebTableReader (-stats | -url [url] | -dump <out_dir> [-regex regex])[-crawlId <id>] [-content] [-headers] [-links] [-text]-crawlId <id> - the id to prefix the schemas to operate on,(default: storage.crawl.id)-stats [-sort] - print overall statistics to System.out[-sort] - list status sorted by host-url <url> - print information on <url> to System.out-dump <out_dir> [-regex regex] - dump the webtable to a text file in<out_dir>-content - dump also raw content-headers - dump protocol headers-links - dump links-text - dump extracted text[-regex] - filter on the URL of the webtable entry
示例:
(1)seed.txt的內容為:
http://www.163.com

(2)執行以下命令進行inject操作
?bin/nutch inject seed.txt -crawlId test001

(3)scan表中內容,發現無意義

hbase(main):002:0> scan 'test001_webpage' ROW COLUMN+CELL com.163.money:http/ column=f:fi, timestamp=1423550107073, value=\x00'\x8D\x00 com.163.money:http/ column=f:ts, timestamp=1423550107073, value=\x00\x00\x01Kr2\xC7\xD6 com.163.money:http/ column=mk:_injmrk_, timestamp=1423550107073, value=y com.163.money:http/ column=mk:dist, timestamp=1423550107073, value=0 com.163.money:http/ column=mtdt:_csh_, timestamp=1423550107073, value=?\x80\x00\x00 com.163.money:http/ column=s:s, timestamp=1423550107073, value=?\x80\x00\x00 1 row(s) in 0.4090 seconds

(4)將表中內容讀取到/mnt/jediael/2
bin/nutch readdb -dump /mnt/jediael/2 -crawlId test001 -content
(5)查看/mnt/jediael/2中的內容
$ ll total 4 -rwxrwxrwx. 1 jediael jediael 344 Feb 10 14:41 part-r-00000 -rwxrwxrwx. 1 jediael jediael 0 Feb 10 14:41 _SUCCESS
$ cat part-r-00000 http://money.163.com/ key: com.163.money:http/ baseUrl: null status: 0 (null) fetchTime: 1423550105558 prevFetchTime: 0 fetchInterval: 2592000 retriesSinceFetch: 0 modifiedTime: 0 prevModifiedTime: 0 protocolStatus: (null) parseStatus: (null) title: null score: 1.0 marker _injmrk_ : y marker dist : 0 reprUrl: null metadata _csh_ : ?錕






總結

以上是生活随笔為你收集整理的读取Webpage表中的内容的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。