I am trying to get earnings calendar information without using yahoo or nasdaq since they are not always accurate.
Bloomberg's website has earnings information at the following url:
https://www.bloomberg.com/markets/earnings-calendar/us
When I inspect the html source for the page, I found the html code block that controls the date picking calendar tool and inspected the some of the event code that I've marked EV#1, EV#2, EV#3, and EV#4 for reference.
button
I've found that each of these EV#n events refer to some jQuery code that handle click events.
When I highlight the event related toolbox in the web inspector at each EV#n, I see code descriptions with either JQuery or Bubbling, DOM2.
I have no idea what these mean, but perhaps it's not so important at this stage. I've included the descriptions and which EV#'s correspond to the code below. Perhaps it is helpful..
JQuery: (EV#1)
tellMeTheSelectedDate: function() {
r.locale(this.locale);
var e = this.$datePicker().datepicker("getDate"),
t = r(e).format("L");
a.log(t)
}
Bubbling, DOM2: (EV#1, EV#2, EV#3, EV#4)
function An(e) {
if (Gi) {
var t = Cn(e);
if (t && this.id == t.id) {
var n = In(t);
if (n && kn(e)) {
var r = Rn(n);
r.PX263 = d(t), re("PX217", r), ji++, Fi <= ji && (Gi = !1, Dn(!1))
}
}
}
}
Bubbling, DOM2: (EV#1, EV#4)
u = b.handle = function(e) {
return typeof d === R || e && d.event.triggered === e.type ? void
0 : d.event.dispatch.apply(u.elem, arguments)
}
jQuery: (EV#4)
function() {
return e.datepicker._datepickerShowing &&
e.datepicker._lastInput === t[0] ? e.datepicker._hideDatepicker()
: e.datepicker._datepickerShowing && e.datepicker._lastInput !==
t[0] ? (e.datepicker._hideDatepicker(),
e.datepicker._showDatepicker(t[0])) :
e.datepicker._showDatepicker(t[0]), !1
}
GOAL:
I have no experience with JQuery, but I know it uses CSS descriptors to dynamically alter web content.
Is it possible for me to use Requests and send a "picked date" (a date string) to the date picking widget by modifying whatever variable stores this value from the calendar tool so that the page refreshes(is this right?) and displays earnings information in the table based on the date I have passed via script?
Would I need to emulate a "click" event to get the page to update with my date?
Getting the data from the table using bs4 is no issue, but my main problem is the date selection.
Thanks in advance
解决方案
If you open developer tools in your browser (F12) and go to the network tab, you can sniff out the request the page is making when you change the date on the calendar. In doing so, you can pass in whichever date you like as a URL parameter:
https://www.bloomberg.com/markets/api/calendar/earnings/US?locale=en&date=2018-04-30
博主尝试从Bloomberg网站获取收益日历信息,发现其依赖jQuery处理日期选择事件。通过浏览器开发者工具,他们观察到与日期选择相关的jQuery代码,并希望了解如何利用Requests库发送自定义日期,使页面刷新并显示对应日期的收益数据。解决方案建议通过分析网络请求,找到更改日期参数的API,直接传递自定义日期来获取所需信息。
2089

被折叠的 条评论
为什么被折叠?



