मुझे लगता है कि आप कमांड लाइन से wget का उपयोग कर सकते हैं।
wget -U "Firefox/3.0.15" http://www.google.com/search?q=SEARCH+TERMS+HERE -O result.html -q
या -O- -q
स्टडआउट के आउटपुट के लिए। एचटीएमएल से परिणामों को स्क्रैप करना पूरी तरह से एक अलग मामला होगा, हालांकि।
यदि आप wget प्राप्त करते हैं, तो grep के साथ-साथ GnuWin32 भी प्राप्त हो सकता है, क्योंकि यह काफी उपयोगी है। फिर आप इस तरह की चीजें कर सकते हैं:
wget -U "Firefox/3.0.15" "http://www.google.com/search?q=wget+google+search" -O- -q 2>&1 | grep -E -o -e "<cite>[^<]+</cite>" | sed -r -e "s/<[^>]+>//g"
... Google खोज से पहले लिंक का URL प्राप्त करने के लिए। आकाश की सीमा है। रचनात्मक हो।
(उपरोक्त उदाहरण आदेश के आउटपुट: isaksen.biz/blog/?p=470
)
आप पहला खिताब के साथ साथ पहले URL दिखाने के लिए चाहते हैं, यह एक छोटे और अधिक जटिल हो जाता है।
@echo off
setlocal enabledelayedexpansion
set search=%1 %2 %3 %4 %5 %6 %7 %8 %9
for /l %%a in (1,1,8) do if "!search:~-1!"==" " set search=!search:~0,-1!
set search=%search: =+%
wget -U "Firefox/3.0.15" "http://www.google.com/search?q=%search%" -O search.html -q 2>NUL
for /f "tokens=*" %%I in ('grep -P -o "<h3 class=.*?</h3>" search.html ^| sed -r -e "s/<[^>]+>//g"') do (
echo %%I
goto next
)
:next
set /p I="http://"<NUL
for /f "tokens=*" %%I in ('grep -E -o -e "<cite>[^<]+</cite>" search.html ^| sed -r -e "s/<[^>]+>//g"') do (
echo %%I
del /q search.html
goto :EOF
)
उपयोग: search.bat up to 9 search terms here
उदाहरण:
C:\Users\me\Desktop>search command line google
googlecl - Command line tools for the Google Data APIs - Google ...
http://goosh.org/
C:\Users\me\Desktop>
क्या आप केवल कमांड प्रॉम्प्ट का उपयोग कर मृत सेट हैं? यदि हां, तो कमांड प्रॉम्प्ट में कोई उपकरण नहीं है जिससे आप ऐसा कर सकें। सबसे अच्छा आप www.google.com पिंग कर सकते हैं, लेकिन वेब ब्राउज़र के स्थान पर कमांड प्रॉम्प्ट का उपयोग नहीं किया जा सकता है। अब, यदि आप शायद PowerShell कहने के लिए खुले हैं, तो यह एक अलग कहानी है। – TimWagaman
ठीक है। मैं पावरशेल में देखूंगा। PowerShell में आप यह कैसे कर सकते हैं? मैं PowerShell से बहुत अपरिचित हूँ। –
@ R_USER82 शक्तियों में आप [psgoogle] (https://www.powershellgallery.com/packages/PsGoogle) का उपयोग कर सकते हैं – gordy