Fill stock input in searchbox on moneycontrol site using beautifulsoup2019 Community Moderator ElectionUser input and command line argumentsHow do I find the location of my Python site-packages directory?retrieve links from web page using python and BeautifulSoupBeautifulSoup Grab Visible Webpage TextImportError: No module named BeautifulSoupBeautifulSoup getting hrefcan we use xpath with BeautifulSoup?Python beautifulsoup - getting input valueImportError: No Module Named bs4 (BeautifulSoup)Difference between BeautifulSoup and Scrapy crawler?

Does splitting a potentially monolithic application into several smaller ones help prevent bugs?

When two POV characters meet

Should QA ask requirements to developers?

What is the definition of "Natural Selection"?

Why would a jet engine that runs at temps excess of 2000°C burn when it crashes?

It's a yearly task, alright

US to Europe trip with Montreal layover - is 52 minutes enough?

Should we release the security issues we found in our product as CVE or we can just update those on weekly release notes?

Need some help with my first LaTeX drawing…

Force user to remove USB token

validation vs test vs training accuracy, which one to compare for claiming overfit?

Identifying the interval from A♭ to D♯

How to make readers know that my work has used a hidden constraint?

Question about partial fractions with irreducible quadratic factors

Plywood subfloor won't screw down in a trailer home

Welcoming 2019 Pi day: How to draw the letter π?

Rejected in 4th interview round citing insufficient years of experience

Life insurance that covers only simultaneous/dual deaths

Coworker uses her breast-pump everywhere in the office

Good for you! in Russian

Latest web browser compatible with Windows 98

What injury would be of little consequence to a biped but terrible for a quadruped?

Making a sword in the stone, in a medieval world without magic

Is going from continuous data to categorical always wrong?



Fill stock input in searchbox on moneycontrol site using beautifulsoup



2019 Community Moderator ElectionUser input and command line argumentsHow do I find the location of my Python site-packages directory?retrieve links from web page using python and BeautifulSoupBeautifulSoup Grab Visible Webpage TextImportError: No module named BeautifulSoupBeautifulSoup getting hrefcan we use xpath with BeautifulSoup?Python beautifulsoup - getting input valueImportError: No Module Named bs4 (BeautifulSoup)Difference between BeautifulSoup and Scrapy crawler?










2















I want to fetch stock information from Moneycontrol site. I want to fill stock name in searchbox.
html code:



<input class="txtsrchbox FL" id="search_str" 
onkeyup="getAutosuggesionHeader('#form_topsearch');"
onclick="getAutosuggesionHeader('#form_topsearch');"
placeholder="Search Quotes, News, NAVs" name="search_str"
value="" type="text" autocomplete="off">


How can i achieve this using beautifulsoup.



I have tried following code:



from BeautifulSoup import BeautifulSoup

import urllib

post_params = 'value' : 'SBIN'

post_args = urllib.parse.urlencode(post_params).encode("utf-8")

url = 'https://www.moneycontrol.com'

fp = urllib.request.urlopen(url, post_args)

soup = BeautifulSoup(fp)









share|improve this question
























  • What data specifically are you wanting to retrieve?

    – QHarr
    Mar 7 at 11:57












  • i want to fetch sbin moneycontrol page.i want to open sbi page when entering sbin to searchbox. Like this other stocks also

    – Pratham
    Mar 7 at 11:59












  • State bank of India?

    – QHarr
    Mar 7 at 12:00






  • 1





    Yes state bank of india

    – Pratham
    Mar 7 at 12:03











  • Can you give one other search term please?

    – QHarr
    Mar 7 at 12:04















2















I want to fetch stock information from Moneycontrol site. I want to fill stock name in searchbox.
html code:



<input class="txtsrchbox FL" id="search_str" 
onkeyup="getAutosuggesionHeader('#form_topsearch');"
onclick="getAutosuggesionHeader('#form_topsearch');"
placeholder="Search Quotes, News, NAVs" name="search_str"
value="" type="text" autocomplete="off">


How can i achieve this using beautifulsoup.



I have tried following code:



from BeautifulSoup import BeautifulSoup

import urllib

post_params = 'value' : 'SBIN'

post_args = urllib.parse.urlencode(post_params).encode("utf-8")

url = 'https://www.moneycontrol.com'

fp = urllib.request.urlopen(url, post_args)

soup = BeautifulSoup(fp)









share|improve this question
























  • What data specifically are you wanting to retrieve?

    – QHarr
    Mar 7 at 11:57












  • i want to fetch sbin moneycontrol page.i want to open sbi page when entering sbin to searchbox. Like this other stocks also

    – Pratham
    Mar 7 at 11:59












  • State bank of India?

    – QHarr
    Mar 7 at 12:00






  • 1





    Yes state bank of india

    – Pratham
    Mar 7 at 12:03











  • Can you give one other search term please?

    – QHarr
    Mar 7 at 12:04













2












2








2








I want to fetch stock information from Moneycontrol site. I want to fill stock name in searchbox.
html code:



<input class="txtsrchbox FL" id="search_str" 
onkeyup="getAutosuggesionHeader('#form_topsearch');"
onclick="getAutosuggesionHeader('#form_topsearch');"
placeholder="Search Quotes, News, NAVs" name="search_str"
value="" type="text" autocomplete="off">


How can i achieve this using beautifulsoup.



I have tried following code:



from BeautifulSoup import BeautifulSoup

import urllib

post_params = 'value' : 'SBIN'

post_args = urllib.parse.urlencode(post_params).encode("utf-8")

url = 'https://www.moneycontrol.com'

fp = urllib.request.urlopen(url, post_args)

soup = BeautifulSoup(fp)









share|improve this question
















I want to fetch stock information from Moneycontrol site. I want to fill stock name in searchbox.
html code:



<input class="txtsrchbox FL" id="search_str" 
onkeyup="getAutosuggesionHeader('#form_topsearch');"
onclick="getAutosuggesionHeader('#form_topsearch');"
placeholder="Search Quotes, News, NAVs" name="search_str"
value="" type="text" autocomplete="off">


How can i achieve this using beautifulsoup.



I have tried following code:



from BeautifulSoup import BeautifulSoup

import urllib

post_params = 'value' : 'SBIN'

post_args = urllib.parse.urlencode(post_params).encode("utf-8")

url = 'https://www.moneycontrol.com'

fp = urllib.request.urlopen(url, post_args)

soup = BeautifulSoup(fp)






python beautifulsoup






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 7 at 15:47









PS1212

604514




604514










asked Mar 7 at 10:43









PrathamPratham

217




217












  • What data specifically are you wanting to retrieve?

    – QHarr
    Mar 7 at 11:57












  • i want to fetch sbin moneycontrol page.i want to open sbi page when entering sbin to searchbox. Like this other stocks also

    – Pratham
    Mar 7 at 11:59












  • State bank of India?

    – QHarr
    Mar 7 at 12:00






  • 1





    Yes state bank of india

    – Pratham
    Mar 7 at 12:03











  • Can you give one other search term please?

    – QHarr
    Mar 7 at 12:04

















  • What data specifically are you wanting to retrieve?

    – QHarr
    Mar 7 at 11:57












  • i want to fetch sbin moneycontrol page.i want to open sbi page when entering sbin to searchbox. Like this other stocks also

    – Pratham
    Mar 7 at 11:59












  • State bank of India?

    – QHarr
    Mar 7 at 12:00






  • 1





    Yes state bank of india

    – Pratham
    Mar 7 at 12:03











  • Can you give one other search term please?

    – QHarr
    Mar 7 at 12:04
















What data specifically are you wanting to retrieve?

– QHarr
Mar 7 at 11:57






What data specifically are you wanting to retrieve?

– QHarr
Mar 7 at 11:57














i want to fetch sbin moneycontrol page.i want to open sbi page when entering sbin to searchbox. Like this other stocks also

– Pratham
Mar 7 at 11:59






i want to fetch sbin moneycontrol page.i want to open sbi page when entering sbin to searchbox. Like this other stocks also

– Pratham
Mar 7 at 11:59














State bank of India?

– QHarr
Mar 7 at 12:00





State bank of India?

– QHarr
Mar 7 at 12:00




1




1





Yes state bank of india

– Pratham
Mar 7 at 12:03





Yes state bank of india

– Pratham
Mar 7 at 12:03













Can you give one other search term please?

– QHarr
Mar 7 at 12:04





Can you give one other search term please?

– QHarr
Mar 7 at 12:04












1 Answer
1






active

oldest

votes


















1














I'm not familiar with financial info so this might not be of use, but maybe it is, or maybe QHarr can work off of it. Looks like it gives back some value for (t:time?, cp:closing price? v:volume? ap:???)



So I noticed you can get some response from the chart data, however it requires to enter a parameter to query (ie. a sc_id value, in this case for SBIN, is SBI.)



So I needed a way though to get that sc_id value, and saw they have a "suggested" text search return that can be accessed to enter your search word (ie: "sbin"), to get back that sc_id.



So here's a little script that was able to get some info back for SBIN. Hopefully this can get some use out of it:



import requests
import json

headers = 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36'


# Enter search text
query_input = input('Enter Search Text: ')

#Get suggested sc_id
suggest_query_url = 'https://www.moneycontrol.com/mccode/common/autosuggestion_solr.php'

query =
'classic': 'true',
'query': query_input,
'type': '1',
'format': 'json',
'callback': 'suggest1'


# Pull out the sc_id
suggested_response = requests.get(suggest_query_url , headers=headers, params=query).text
suggested_response = suggested_response.split('(',1)[1]
suggested_response = suggested_response.rsplit(')',1)[0]

sc_id = json.loads(suggested_response)[0]['sc_id']


# Use the sc_id to get BSE and NSE data
request_url = 'https://www.moneycontrol.com/stocks/company_info/get_vwap_chart_data.php'
query = 'sc_did': sc_id

response = requests.get(request_url, headers=headers, params=query).json()


Output:



print (response)
{'BSE': ['t': '1551949665', 'ap': '279.70', 'cp': '279.70', 'v': '2151', 't': '1551949704', 'ap': '279.70', 'cp': '279.70', 'v': '2151', 't': '1551949740', 'ap': '279.70', 'cp': '279.70', 'v': '2151', 't': '1551950159', 'ap': '278.93', 'cp': '278.90', 'v': '18755', 't': '1551950219', 'ap': '278.90', 'cp': '278.70', 'v': '23368', 't': '1551950279', 'ap': '278.89', 'cp': '279.00', 'v': '32498', 't': '1551950338', 'ap': '278.91', 'cp': '279.00', 'v': '36396', 't': '1551950399', 'ap': '278.90', 'cp': '278.80', 'v': '42964', 't': '1551950459', 'ap': '278.88', 'cp': '278.35', 'v': '45685', 't': '1551950519', 'ap': '278.76', 'cp': '278.30', 'v': '54082', 't': '1551950579', 'ap': '278.74', 'cp': '278.30', 'v': '56780', 't': '1551950639', 'ap': '278.69', 'cp': '278.20', 'v': '62504', 't': '1551950699', 'ap': '278.68', 'cp': '278.10', 'v': '63338', 't': '1551950759', 'ap': '278.68', 'cp': '278.10', 'v': '63723', 't': '1551950819', 'ap': '278.67', 'cp': '277.80', 'v': '64998', 't': '1551950879', 'ap': '278.63', 'cp': '278.20', 'v': '68780', 't': '1551950939', 'ap': '278.59', 'cp': '278.60', 'v': '77680', 't': '1551950999', 'ap': '278.59', 'cp': '278.35', 'v': '79316', 't': '1551951059', 'ap': '278.58', 'cp': '278.30', 'v': '80566', 't': '1551951119', 'ap': '278.58', 'cp': '278.20', 'v': '81247', 't': '1551951178', 'ap': '278.57', 'cp': '278.10', 'v': '82067', 't': '1551951238', 'ap': '278.57', 'cp': '278.15', 'v': '82918', 't': '1551951294', 'ap': '278.56', 'cp': '278.60', 'v': '85734', 't': '1551951358', 'ap': '278.56', 'cp': '278.40', 'v': '87239', 't': '1551951419', 'ap': '278.56', 'cp': '278.25', 'v': '88039', ...





share|improve this answer























  • if you know the industry (banking etc) you can combine that with the id to pass in a url query string to get info from indiv pages I think. I was looking earlier but am on course at moment.

    – QHarr
    Mar 7 at 15:10











  • actually i want to fetch stock's news..my idea was to soup monecontrol site then directly giving sbin or state bank of india parameter to input text value...

    – Pratham
    Mar 8 at 4:36










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55041850%2ffill-stock-input-in-searchbox-on-moneycontrol-site-using-beautifulsoup%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














I'm not familiar with financial info so this might not be of use, but maybe it is, or maybe QHarr can work off of it. Looks like it gives back some value for (t:time?, cp:closing price? v:volume? ap:???)



So I noticed you can get some response from the chart data, however it requires to enter a parameter to query (ie. a sc_id value, in this case for SBIN, is SBI.)



So I needed a way though to get that sc_id value, and saw they have a "suggested" text search return that can be accessed to enter your search word (ie: "sbin"), to get back that sc_id.



So here's a little script that was able to get some info back for SBIN. Hopefully this can get some use out of it:



import requests
import json

headers = 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36'


# Enter search text
query_input = input('Enter Search Text: ')

#Get suggested sc_id
suggest_query_url = 'https://www.moneycontrol.com/mccode/common/autosuggestion_solr.php'

query =
'classic': 'true',
'query': query_input,
'type': '1',
'format': 'json',
'callback': 'suggest1'


# Pull out the sc_id
suggested_response = requests.get(suggest_query_url , headers=headers, params=query).text
suggested_response = suggested_response.split('(',1)[1]
suggested_response = suggested_response.rsplit(')',1)[0]

sc_id = json.loads(suggested_response)[0]['sc_id']


# Use the sc_id to get BSE and NSE data
request_url = 'https://www.moneycontrol.com/stocks/company_info/get_vwap_chart_data.php'
query = 'sc_did': sc_id

response = requests.get(request_url, headers=headers, params=query).json()


Output:



print (response)
{'BSE': ['t': '1551949665', 'ap': '279.70', 'cp': '279.70', 'v': '2151', 't': '1551949704', 'ap': '279.70', 'cp': '279.70', 'v': '2151', 't': '1551949740', 'ap': '279.70', 'cp': '279.70', 'v': '2151', 't': '1551950159', 'ap': '278.93', 'cp': '278.90', 'v': '18755', 't': '1551950219', 'ap': '278.90', 'cp': '278.70', 'v': '23368', 't': '1551950279', 'ap': '278.89', 'cp': '279.00', 'v': '32498', 't': '1551950338', 'ap': '278.91', 'cp': '279.00', 'v': '36396', 't': '1551950399', 'ap': '278.90', 'cp': '278.80', 'v': '42964', 't': '1551950459', 'ap': '278.88', 'cp': '278.35', 'v': '45685', 't': '1551950519', 'ap': '278.76', 'cp': '278.30', 'v': '54082', 't': '1551950579', 'ap': '278.74', 'cp': '278.30', 'v': '56780', 't': '1551950639', 'ap': '278.69', 'cp': '278.20', 'v': '62504', 't': '1551950699', 'ap': '278.68', 'cp': '278.10', 'v': '63338', 't': '1551950759', 'ap': '278.68', 'cp': '278.10', 'v': '63723', 't': '1551950819', 'ap': '278.67', 'cp': '277.80', 'v': '64998', 't': '1551950879', 'ap': '278.63', 'cp': '278.20', 'v': '68780', 't': '1551950939', 'ap': '278.59', 'cp': '278.60', 'v': '77680', 't': '1551950999', 'ap': '278.59', 'cp': '278.35', 'v': '79316', 't': '1551951059', 'ap': '278.58', 'cp': '278.30', 'v': '80566', 't': '1551951119', 'ap': '278.58', 'cp': '278.20', 'v': '81247', 't': '1551951178', 'ap': '278.57', 'cp': '278.10', 'v': '82067', 't': '1551951238', 'ap': '278.57', 'cp': '278.15', 'v': '82918', 't': '1551951294', 'ap': '278.56', 'cp': '278.60', 'v': '85734', 't': '1551951358', 'ap': '278.56', 'cp': '278.40', 'v': '87239', 't': '1551951419', 'ap': '278.56', 'cp': '278.25', 'v': '88039', ...





share|improve this answer























  • if you know the industry (banking etc) you can combine that with the id to pass in a url query string to get info from indiv pages I think. I was looking earlier but am on course at moment.

    – QHarr
    Mar 7 at 15:10











  • actually i want to fetch stock's news..my idea was to soup monecontrol site then directly giving sbin or state bank of india parameter to input text value...

    – Pratham
    Mar 8 at 4:36















1














I'm not familiar with financial info so this might not be of use, but maybe it is, or maybe QHarr can work off of it. Looks like it gives back some value for (t:time?, cp:closing price? v:volume? ap:???)



So I noticed you can get some response from the chart data, however it requires to enter a parameter to query (ie. a sc_id value, in this case for SBIN, is SBI.)



So I needed a way though to get that sc_id value, and saw they have a "suggested" text search return that can be accessed to enter your search word (ie: "sbin"), to get back that sc_id.



So here's a little script that was able to get some info back for SBIN. Hopefully this can get some use out of it:



import requests
import json

headers = 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36'


# Enter search text
query_input = input('Enter Search Text: ')

#Get suggested sc_id
suggest_query_url = 'https://www.moneycontrol.com/mccode/common/autosuggestion_solr.php'

query =
'classic': 'true',
'query': query_input,
'type': '1',
'format': 'json',
'callback': 'suggest1'


# Pull out the sc_id
suggested_response = requests.get(suggest_query_url , headers=headers, params=query).text
suggested_response = suggested_response.split('(',1)[1]
suggested_response = suggested_response.rsplit(')',1)[0]

sc_id = json.loads(suggested_response)[0]['sc_id']


# Use the sc_id to get BSE and NSE data
request_url = 'https://www.moneycontrol.com/stocks/company_info/get_vwap_chart_data.php'
query = 'sc_did': sc_id

response = requests.get(request_url, headers=headers, params=query).json()


Output:



print (response)
{'BSE': ['t': '1551949665', 'ap': '279.70', 'cp': '279.70', 'v': '2151', 't': '1551949704', 'ap': '279.70', 'cp': '279.70', 'v': '2151', 't': '1551949740', 'ap': '279.70', 'cp': '279.70', 'v': '2151', 't': '1551950159', 'ap': '278.93', 'cp': '278.90', 'v': '18755', 't': '1551950219', 'ap': '278.90', 'cp': '278.70', 'v': '23368', 't': '1551950279', 'ap': '278.89', 'cp': '279.00', 'v': '32498', 't': '1551950338', 'ap': '278.91', 'cp': '279.00', 'v': '36396', 't': '1551950399', 'ap': '278.90', 'cp': '278.80', 'v': '42964', 't': '1551950459', 'ap': '278.88', 'cp': '278.35', 'v': '45685', 't': '1551950519', 'ap': '278.76', 'cp': '278.30', 'v': '54082', 't': '1551950579', 'ap': '278.74', 'cp': '278.30', 'v': '56780', 't': '1551950639', 'ap': '278.69', 'cp': '278.20', 'v': '62504', 't': '1551950699', 'ap': '278.68', 'cp': '278.10', 'v': '63338', 't': '1551950759', 'ap': '278.68', 'cp': '278.10', 'v': '63723', 't': '1551950819', 'ap': '278.67', 'cp': '277.80', 'v': '64998', 't': '1551950879', 'ap': '278.63', 'cp': '278.20', 'v': '68780', 't': '1551950939', 'ap': '278.59', 'cp': '278.60', 'v': '77680', 't': '1551950999', 'ap': '278.59', 'cp': '278.35', 'v': '79316', 't': '1551951059', 'ap': '278.58', 'cp': '278.30', 'v': '80566', 't': '1551951119', 'ap': '278.58', 'cp': '278.20', 'v': '81247', 't': '1551951178', 'ap': '278.57', 'cp': '278.10', 'v': '82067', 't': '1551951238', 'ap': '278.57', 'cp': '278.15', 'v': '82918', 't': '1551951294', 'ap': '278.56', 'cp': '278.60', 'v': '85734', 't': '1551951358', 'ap': '278.56', 'cp': '278.40', 'v': '87239', 't': '1551951419', 'ap': '278.56', 'cp': '278.25', 'v': '88039', ...





share|improve this answer























  • if you know the industry (banking etc) you can combine that with the id to pass in a url query string to get info from indiv pages I think. I was looking earlier but am on course at moment.

    – QHarr
    Mar 7 at 15:10











  • actually i want to fetch stock's news..my idea was to soup monecontrol site then directly giving sbin or state bank of india parameter to input text value...

    – Pratham
    Mar 8 at 4:36













1












1








1







I'm not familiar with financial info so this might not be of use, but maybe it is, or maybe QHarr can work off of it. Looks like it gives back some value for (t:time?, cp:closing price? v:volume? ap:???)



So I noticed you can get some response from the chart data, however it requires to enter a parameter to query (ie. a sc_id value, in this case for SBIN, is SBI.)



So I needed a way though to get that sc_id value, and saw they have a "suggested" text search return that can be accessed to enter your search word (ie: "sbin"), to get back that sc_id.



So here's a little script that was able to get some info back for SBIN. Hopefully this can get some use out of it:



import requests
import json

headers = 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36'


# Enter search text
query_input = input('Enter Search Text: ')

#Get suggested sc_id
suggest_query_url = 'https://www.moneycontrol.com/mccode/common/autosuggestion_solr.php'

query =
'classic': 'true',
'query': query_input,
'type': '1',
'format': 'json',
'callback': 'suggest1'


# Pull out the sc_id
suggested_response = requests.get(suggest_query_url , headers=headers, params=query).text
suggested_response = suggested_response.split('(',1)[1]
suggested_response = suggested_response.rsplit(')',1)[0]

sc_id = json.loads(suggested_response)[0]['sc_id']


# Use the sc_id to get BSE and NSE data
request_url = 'https://www.moneycontrol.com/stocks/company_info/get_vwap_chart_data.php'
query = 'sc_did': sc_id

response = requests.get(request_url, headers=headers, params=query).json()


Output:



print (response)
{'BSE': ['t': '1551949665', 'ap': '279.70', 'cp': '279.70', 'v': '2151', 't': '1551949704', 'ap': '279.70', 'cp': '279.70', 'v': '2151', 't': '1551949740', 'ap': '279.70', 'cp': '279.70', 'v': '2151', 't': '1551950159', 'ap': '278.93', 'cp': '278.90', 'v': '18755', 't': '1551950219', 'ap': '278.90', 'cp': '278.70', 'v': '23368', 't': '1551950279', 'ap': '278.89', 'cp': '279.00', 'v': '32498', 't': '1551950338', 'ap': '278.91', 'cp': '279.00', 'v': '36396', 't': '1551950399', 'ap': '278.90', 'cp': '278.80', 'v': '42964', 't': '1551950459', 'ap': '278.88', 'cp': '278.35', 'v': '45685', 't': '1551950519', 'ap': '278.76', 'cp': '278.30', 'v': '54082', 't': '1551950579', 'ap': '278.74', 'cp': '278.30', 'v': '56780', 't': '1551950639', 'ap': '278.69', 'cp': '278.20', 'v': '62504', 't': '1551950699', 'ap': '278.68', 'cp': '278.10', 'v': '63338', 't': '1551950759', 'ap': '278.68', 'cp': '278.10', 'v': '63723', 't': '1551950819', 'ap': '278.67', 'cp': '277.80', 'v': '64998', 't': '1551950879', 'ap': '278.63', 'cp': '278.20', 'v': '68780', 't': '1551950939', 'ap': '278.59', 'cp': '278.60', 'v': '77680', 't': '1551950999', 'ap': '278.59', 'cp': '278.35', 'v': '79316', 't': '1551951059', 'ap': '278.58', 'cp': '278.30', 'v': '80566', 't': '1551951119', 'ap': '278.58', 'cp': '278.20', 'v': '81247', 't': '1551951178', 'ap': '278.57', 'cp': '278.10', 'v': '82067', 't': '1551951238', 'ap': '278.57', 'cp': '278.15', 'v': '82918', 't': '1551951294', 'ap': '278.56', 'cp': '278.60', 'v': '85734', 't': '1551951358', 'ap': '278.56', 'cp': '278.40', 'v': '87239', 't': '1551951419', 'ap': '278.56', 'cp': '278.25', 'v': '88039', ...





share|improve this answer













I'm not familiar with financial info so this might not be of use, but maybe it is, or maybe QHarr can work off of it. Looks like it gives back some value for (t:time?, cp:closing price? v:volume? ap:???)



So I noticed you can get some response from the chart data, however it requires to enter a parameter to query (ie. a sc_id value, in this case for SBIN, is SBI.)



So I needed a way though to get that sc_id value, and saw they have a "suggested" text search return that can be accessed to enter your search word (ie: "sbin"), to get back that sc_id.



So here's a little script that was able to get some info back for SBIN. Hopefully this can get some use out of it:



import requests
import json

headers = 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36'


# Enter search text
query_input = input('Enter Search Text: ')

#Get suggested sc_id
suggest_query_url = 'https://www.moneycontrol.com/mccode/common/autosuggestion_solr.php'

query =
'classic': 'true',
'query': query_input,
'type': '1',
'format': 'json',
'callback': 'suggest1'


# Pull out the sc_id
suggested_response = requests.get(suggest_query_url , headers=headers, params=query).text
suggested_response = suggested_response.split('(',1)[1]
suggested_response = suggested_response.rsplit(')',1)[0]

sc_id = json.loads(suggested_response)[0]['sc_id']


# Use the sc_id to get BSE and NSE data
request_url = 'https://www.moneycontrol.com/stocks/company_info/get_vwap_chart_data.php'
query = 'sc_did': sc_id

response = requests.get(request_url, headers=headers, params=query).json()


Output:



print (response)
{'BSE': ['t': '1551949665', 'ap': '279.70', 'cp': '279.70', 'v': '2151', 't': '1551949704', 'ap': '279.70', 'cp': '279.70', 'v': '2151', 't': '1551949740', 'ap': '279.70', 'cp': '279.70', 'v': '2151', 't': '1551950159', 'ap': '278.93', 'cp': '278.90', 'v': '18755', 't': '1551950219', 'ap': '278.90', 'cp': '278.70', 'v': '23368', 't': '1551950279', 'ap': '278.89', 'cp': '279.00', 'v': '32498', 't': '1551950338', 'ap': '278.91', 'cp': '279.00', 'v': '36396', 't': '1551950399', 'ap': '278.90', 'cp': '278.80', 'v': '42964', 't': '1551950459', 'ap': '278.88', 'cp': '278.35', 'v': '45685', 't': '1551950519', 'ap': '278.76', 'cp': '278.30', 'v': '54082', 't': '1551950579', 'ap': '278.74', 'cp': '278.30', 'v': '56780', 't': '1551950639', 'ap': '278.69', 'cp': '278.20', 'v': '62504', 't': '1551950699', 'ap': '278.68', 'cp': '278.10', 'v': '63338', 't': '1551950759', 'ap': '278.68', 'cp': '278.10', 'v': '63723', 't': '1551950819', 'ap': '278.67', 'cp': '277.80', 'v': '64998', 't': '1551950879', 'ap': '278.63', 'cp': '278.20', 'v': '68780', 't': '1551950939', 'ap': '278.59', 'cp': '278.60', 'v': '77680', 't': '1551950999', 'ap': '278.59', 'cp': '278.35', 'v': '79316', 't': '1551951059', 'ap': '278.58', 'cp': '278.30', 'v': '80566', 't': '1551951119', 'ap': '278.58', 'cp': '278.20', 'v': '81247', 't': '1551951178', 'ap': '278.57', 'cp': '278.10', 'v': '82067', 't': '1551951238', 'ap': '278.57', 'cp': '278.15', 'v': '82918', 't': '1551951294', 'ap': '278.56', 'cp': '278.60', 'v': '85734', 't': '1551951358', 'ap': '278.56', 'cp': '278.40', 'v': '87239', 't': '1551951419', 'ap': '278.56', 'cp': '278.25', 'v': '88039', ...






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 7 at 14:55









chitown88chitown88

4,8221524




4,8221524












  • if you know the industry (banking etc) you can combine that with the id to pass in a url query string to get info from indiv pages I think. I was looking earlier but am on course at moment.

    – QHarr
    Mar 7 at 15:10











  • actually i want to fetch stock's news..my idea was to soup monecontrol site then directly giving sbin or state bank of india parameter to input text value...

    – Pratham
    Mar 8 at 4:36

















  • if you know the industry (banking etc) you can combine that with the id to pass in a url query string to get info from indiv pages I think. I was looking earlier but am on course at moment.

    – QHarr
    Mar 7 at 15:10











  • actually i want to fetch stock's news..my idea was to soup monecontrol site then directly giving sbin or state bank of india parameter to input text value...

    – Pratham
    Mar 8 at 4:36
















if you know the industry (banking etc) you can combine that with the id to pass in a url query string to get info from indiv pages I think. I was looking earlier but am on course at moment.

– QHarr
Mar 7 at 15:10





if you know the industry (banking etc) you can combine that with the id to pass in a url query string to get info from indiv pages I think. I was looking earlier but am on course at moment.

– QHarr
Mar 7 at 15:10













actually i want to fetch stock's news..my idea was to soup monecontrol site then directly giving sbin or state bank of india parameter to input text value...

– Pratham
Mar 8 at 4:36





actually i want to fetch stock's news..my idea was to soup monecontrol site then directly giving sbin or state bank of india parameter to input text value...

– Pratham
Mar 8 at 4:36



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55041850%2ffill-stock-input-in-searchbox-on-moneycontrol-site-using-beautifulsoup%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived