![]() |
Модераторы: LSD, AntonSaburov |
![]() ![]() ![]() |
|
Zhenia87 |
|
||||
![]() Новичок Профиль Группа: Участник Сообщений: 12 Регистрация: 12.11.2007 Где: Украина, Винница Репутация: нет Всего: нет |
Мне надо записать все урл которые выдает гугл при запросе(насколько я понял с описания задания и примера). У меня есть программа которая делает парсинг сайта, но когда я беру урл, например, такой как в примере задания:
http://www.google.com/search?hl=en&q=%...amp;btnG=Search , то программа выдает такое: Exception in thread "main" java.io.IOException: Server returned HTTP response code: 403 for URL: http://www.google.com/search?hl=en&q=%...amp;btnG=Search at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1170) at java.net.URL.openStream(URL.java:1007) at geturls.ReadTag.<init>(ReadTag.java:44) at geturls.ReadTag.<init>(ReadTag.java:37) at geturls.GetURLs.<init>(GetURLs.java:14) at geturls.GetURLs.main(GetURLs.java:41) Если , я беру например такой урл : www.google.com , то программа отлично работает. ЗАДАНИЕ: Name of project: GetUrls description: Goal of the program is to make a lists of links copied from the google pages for each keyword supplied, Using also words collected in order to present less pages on google. 1.The program takes a list of "Keywords" (notice keywords can be queries to google that includes google commands, for example: "google.com -inurl:google.com" is considered a keyword aswell. This list is called: main_keywords.txt 2.For each of the keywords, The program will search google (using a different datacenter and different proxy each time), And will need to make 2 lists: 1. Recursive_words.txt - The program will append all the words collected from all the google pages (1.....maximum), each word will be on a new line (Notice words can be unicode also). (Remove duplicate words, remove html elements like <a href=> etc...) 2. Collected_Links.txt - The program will append all the full urls collected from the google pages to this list. example: ---------------------------- Main_Keywords.txt contains: ______________________________ "google.com" -inurl:google.com "yahoo.com" -inurl:yahoo.com ______________________________ program will query google like this (notice that "" is part of the query): http://www.google.com/search?hl=en&q=%...amp;btnG=Search http://www.google.com/search?hl=en&q=%...amp;btnG=Search then: 1.The program will take all the "site descriptions" (written in color black) and append them to Recursive_words.txt. each word in a new line. 2.The program will take all the "full urls" (written in color green) and will append the links, each in different lines, to Collected_Links.txt. ПРОГРАММА ДЛЯ ПАРСИНГУ САЙТА: ReadTag.java
GetURLs.java
Это сообщение отредактировал(а) Zhenia87 - 2.4.2008, 18:24 |
||||
|
|||||
![]() ![]() ![]() |
Правила форума "Java" | |
|
Если Вам помогли, и атмосфера форума Вам понравилась, то заходите к нам чаще! С уважением, LSD, AntonSaburov, powerOn, tux. |
1 Пользователей читают эту тему (1 Гостей и 0 Скрытых Пользователей) | |
0 Пользователей: | |
« Предыдущая тема | Java: Работа с сетью | Следующая тема » |
|
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности Powered by Invision Power Board(R) 1.3 © 2003 IPS, Inc. |