Package: webscout
Search for words, documents, images, videos, news, maps and text translation using the DuckDuckGo.com, yep.com, phind.com and you.com
Also containes AI models that you can use⚠️ Warning: use AsyncWEBS in asynchronous codeTable of ContentsTable of ContentsInstallCLI versionCLI version of webscout.AICLI to use LLMRegionsWEBS and AsyncWEBS classesExceptionsusage of webscout1.text()- text search by DuckDuckGo.com and Yep.com2.answers()- instant answers by DuckDuckGo.com and Yep.com3.images()- image search by DuckDuckGo.com and Yep.com4.videos()- video search by DuckDuckGo.com5.news()- news search by DuckDuckGo.com and yep.com6.maps()- map search by DuckDuckGo.com and7.translate()- translation by DuckDuckGo.com and Yep.com8.suggestions()- suggestions by DuckDuckGo.com and Yep.comusage of webscout.AI1.PhindSearch- Search using Phind.com2.YepChat- Chat with mistral 8x7b powered by yepchat3.You.com- search with you.com4.Gemini- search with google geminiusage of image generator from Webscout.AI5.Prodia- make image using prodiausage of special .LLM file from webscout (webscout.LLM)LLMVersion Historyv1.1.0v1.0.9v1.0.8v1.0.7v1.0.6Installpipinstall-UwebscoutCLI versionpython-mwebscout--helpCommandDescriptionpython -m webscout answers -k TextCLI function to perform an answers search using Webscout.python -m webscout images -k TextCLI function to perform an images search using Webscout.python -m webscout maps -k TextCLI function to perform a maps search using Webscout.python -m webscout news -k TextCLI function to perform a news search using Webscout.python -m webscout suggestions  -k TextCLI function to perform a suggestions search using Webscout.python -m webscout text -k TextCLI function to perform a text search using Webscout.python -m webscout translate -k TextCLI function to perform translate using Webscout.python -m webscout versionA command-line interface command that prints and returns the version of the program.python -m webscout videos -k TextCLI function to perform a videos search using DuckDuckGo API.CLI version of webscout.AICommandDescriptionpython -m webscout.AI phindsearch --query "your_query_here"CLI function to perform a search query using Webscout.AI's Phindsearch feature.python -m webscout.AI yepchat --message "your_message_here"CLI function to send a message using Webscout.AI's Yepchat feature.python -m webscout.AI youchat --prompt "your_prompt_here"CLI function to generate a response based on a prompt using Webscout.AI's Youchat feature.python -m webscout.AI gemini --message "tell me about gemma 7b"CLI function to get information about a specific topic using Webscout.AI's Gemini feature.python -m webscout.AI prodia --prompt "car"CLI function to generate content related to a prompt using Webscout.AI's Prodia feature.CLI to use LLMpython-mwebscout.LLMmodel_nameGo To TOPRegionsexpandxa-ar for Arabia
xa-en for Arabia (en)
ar-es for Argentina
au-en for Australia
at-de for Austria
be-fr for Belgium (fr)
be-nl for Belgium (nl)
br-pt for Brazil
bg-bg for Bulgaria
ca-en for Canada
ca-fr for Canada (fr)
ct-ca for Catalan
cl-es for Chile
cn-zh for China
co-es for Colombia
hr-hr for Croatia
cz-cs for Czech Republic
dk-da for Denmark
ee-et for Estonia
fi-fi for Finland
fr-fr for France
de-de for Germany
gr-el for Greece
hk-tzh for Hong Kong
hu-hu for Hungary
in-en for India
id-id for Indonesia
id-en for Indonesia (en)
ie-en for Ireland
il-he for Israel
it-it for Italy
jp-jp for Japan
kr-kr for Korea
lv-lv for Latvia
lt-lt for Lithuania
xl-es for Latin America
my-ms for Malaysia
my-en for Malaysia (en)
mx-es for Mexico
nl-nl for Netherlands
nz-en for New Zealand
no-no for Norway
pe-es for Peru
ph-en for Philippines
ph-tl for Philippines (tl)
pl-pl for Poland
pt-pt for Portugal
ro-ro for Romania
ru-ru for Russia
sg-en for Singapore
sk-sk for Slovak Republic
sl-sl for Slovenia
za-en for South Africa
es-es for Spain
se-sv for Sweden
ch-de for Switzerland (de)
ch-fr for Switzerland (fr)
ch-it for Switzerland (it)
tw-tzh for Taiwan
th-th for Thailand
tr-tr for Turkey
ua-uk for Ukraine
uk-en for United Kingdom
us-en for United States
ue-es for United States (es)
ve-es for Venezuela
vn-vi for Vietnam
wt-wt for No regionGo To TOPWEBS and AsyncWEBS classesThe WEBS and AsyncWEBS classes are used to retrieve search results from DuckDuckGo.com and yep.com periodically.
To use the AsyncWEBS class, you can perform asynchronous operations using Python's asyncio library.
To initialize an instance of the WEBS or AsyncWEBS classes, you can provide the following optional arguments:Here is an example of initializing the WEBS class:fromwebscoutimportWEBS# Instantiating the WEBS class from webscout moduleWEBS_instance=WEBS()# Fetching text results for the query "python programming" with a maximum of 5 resultsresults=[resultforresultinWEBS_instance.text("python programming",max_results=5)]# Displaying the obtained resultsprint(results)Here is an example of initializing the AsyncWEBS class:importasyncioimportloggingimportsysfromitertoolsimportchainfromrandomimportshuffleimportrequestsfromwebscoutimportAsyncWEBS# bypass curl-cffi NotImplementedError in windows https://curl-cffi.readthedocs.io/en/latest/faq/ifsys.platform.lower().startswith("win"):asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())defget_words():word_site="https://www.mit.edu/~ecprice/wordlist.10000"resp=requests.get(word_site)words=resp.text.splitlines()returnwordsasyncdefaget_results(word):asyncwithAsyncWEBS(proxies=proxies)asWEBS:results=[rasyncforrinWEBS.text(word,max_results=None)]returnresultsasyncdefmain():words=get_words()shuffle(words)tasks=[]forwordinwords[:10]:tasks.append(aget_results(word))results=awaitasyncio.gather(*tasks)print(f"Done")forrinchain.from_iterable(results):print(r)if__name__=="__main__":logging.basicConfig(level=logging.DEBUG)asyncio.run(main())It is important to note that the WEBS and AsyncWEBS classes should always be used as a context manager (with statement).
This ensures proper resource management and cleanup, as the context manager will automatically handle opening and closing the HTTP client connection.ExceptionsExceptions:WebscoutE: Raised when there is a generic exception during the API request.usage of webscout1.text()- text search by DuckDuckGo.com and Yep.comfromwebscoutimportWEBS# Text search for 'live free or die' using DuckDuckGo.com and Yep.comwithWEBS()asWEBS:forrinWEBS.text('live free or die',region='wt-wt',safesearch='off',timelimit='y',max_results=10):print(r)forrinWEBS.text('live free or die',region='wt-wt',safesearch='off',timelimit='y',max_results=10):print(r)2.answers()- instant answers by DuckDuckGo.com and Yep.comfromwebscoutimportWEBS# Instant answers for the query "sun" using DuckDuckGo.com and Yep.comwithWEBS()asWEBS:forrinWEBS.answers("sun"):print(r)3.images()- image search by DuckDuckGo.com and Yep.comfromwebscoutimportWEBS# Image search for the keyword 'butterfly' using DuckDuckGo.com and Yep.comwithWEBS()asWEBS:keywords='butterfly'WEBS_images_gen=WEBS.images(keywords,region="wt-wt",safesearch="off",size=None,type_image=None,layout=None,license_image=None,max_results=10,)forrinWEBS_images_gen:print(r)4.videos()- video search by DuckDuckGo.comfromwebscoutimportWEBS# Video search for the keyword 'tesla' using DuckDuckGo.comwithWEBS()asWEBS:keywords='tesla'WEBS_videos_gen=WEBS.videos(keywords,region="wt-wt",safesearch="off",timelimit="w",resolution="high",duration="medium",max_results=10,)forrinWEBS_videos_gen:print(r)5.news()- news search by DuckDuckGo.com and yep.comfromwebscoutimportWEBS# News search for the keyword 'holiday' using DuckDuckGo.com and yep.comwithWEBS()asWEBS:keywords='holiday'WEBS_news_gen=WEBS.news(keywords,region="wt-wt",safesearch="off",timelimit="m",max_results=20)forrinWEBS_news_gen:print(r)6.maps()- map search by DuckDuckGo.com andfromwebscoutimportWEBS# Map search for the keyword 'school' in 'anantnag' using DuckDuckGo.comwithWEBS()asWEBS:forrinWEBS.maps("school",place="anantnag",max_results=50):print(r)7.translate()- translation by DuckDuckGo.com and Yep.comfromwebscoutimportWEBS# Translation of the keyword 'school' to German ('hi') using DuckDuckGo.com and Yep.comwithWEBS()asWEBS:keywords='school'r=WEBS.translate(keywords,to="hi")print(r)8.suggestions()- suggestions by DuckDuckGo.com and Yep.comfromwebscoutimportWEBS# Suggestions for the keyword 'fly' using DuckDuckGo.com and YepwithWEBS()asWEBS:forrinWEBS.suggestions("fly"):print(r)usage of webscout.AI1.PhindSearch- Search using Phind.comThanks to Empyros for PhindSearch functionfromwebscout.AIimportPhindSearchquery='Webscout pypi'# Create an instance of WEBSAI with the queryWEBSAI=PhindSearch(query)WEBSAI.search()2.YepChat- Chat with mistral 8x7b powered by yepchatThanks To Divyansh Shukla for This codefromwebscout.AIimportYepChatdefmain():# Initialize the YepChat class with your messageyep_chat=YepChat(message="who is pm of india")# Send the request and process the responseresponse=yep_chat.send_request()processed_response=yep_chat.process_response(response)# Print the processed responseprint(processed_response)if__name__=="__main__":main()3.You.com- search with you.comfromwebscout.AIimportyouChat# Instantiate the youchat classyouChat=youChat()whileTrue:# Ask the user for a promptprompt=input("💡 Enter a prompt (or type 'exit' to quit): ")# Exit conditionifprompt.lower()=='exit':break# Generate a completion based on the prompttry:completion=youChat.create(prompt)print("💬:",completion)exceptExceptionase:print("⚠️ An error occurred:",e)4.Gemini- search with google geminifromwebscout.AIimportGemini# Create an instance of the Gemini classgemini=Gemini()# Use the chat method to send a message to the Gemini assistantresponse=gemini.chat("Your message here")# Print the response from the Gemini assistantprint(response)usage of image generator from Webscout.AI5.Prodia- make image using prodiafromwebscout.AIimportProdia# Define a prompt for the image generationprompt="A beautiful sunset over the ocean"# Use the prodia_cli method to generate an image based on the promptProdia.prodia_cli(prompt)usage of special .LLM file from webscout (webscout.LLM)LLMfromwebscout.LLMimportLLMdefchat(model_name):AI=LLM(model_name)AI.chat()if__name__=="__main__":model_name="mistralai/Mistral-7B-Instruct-v0.1"# name of the model you wish to use It supports ALL text generation models on deepinfra.com.chat(model_name)Version Historyv1.1.0🌟 Added LLMs as webscout.LLM🔧 Resolved issue related to Prodia functionalityv1.0.9🌌 Added Prodia as an image generator in webscout.AIv1.0.8🚀 Solved issues related to Gemini and Yep Chat functions within the Webscout package.🌟 Gemini function now provides correct outputs without duplication.🌟 Yep Chat function delivers accurate responses without repeating them multiple times.v1.0.7🌟 Added Gemini as part of webscout.AIv1.0.6🌟 Integrated yep.com as a search engine🔧 Resolved error associated with the translation feature🌟 Introduced Phind AI within webscout.AI🌟 Included YepChat as part of webscout.AI🌟 Integrated You.com as part of webscout.AI