Add author etc to github scraper.
This commit is contained in:
parent
be1c3952bb
commit
56c4619cfd
@ -24,15 +24,17 @@ items = list()
|
|||||||
|
|
||||||
for rel in json_data:
|
for rel in json_data:
|
||||||
if rel['prerelease'] and leave_out_prereleases:
|
if rel['prerelease'] and leave_out_prereleases:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
article_url = json.dumps(rel['url'])
|
article_author = json.dumps(rel["author"]["login"])
|
||||||
article_title = json.dumps(rel['tag_name'])
|
article_url = json.dumps(rel["html_url"])
|
||||||
|
article_title = json.dumps(rel["tag_name"])
|
||||||
article_time = json.dumps(datetime.strptime(rel["published_at"], "%Y-%m-%dT%H:%M:%SZ").isoformat())
|
article_time = json.dumps(datetime.strptime(rel["published_at"], "%Y-%m-%dT%H:%M:%SZ").isoformat())
|
||||||
items.append("{{\"title\": {title}, \"content_html\": {html}, \"url\": {url}, \"date_published\": {date}}}".format(title=article_title,
|
items.append("{{\"title\": {title}, \"authors\": [{{\"name\": {author}}}], \"content_html\": {html}, \"url\": {url}, \"date_published\": {date}}}".format(title=article_title,
|
||||||
html=article_title,
|
html=article_title,
|
||||||
url=article_url,
|
url=article_url,
|
||||||
date=article_time))
|
date=article_time,
|
||||||
|
author=article_author))
|
||||||
|
|
||||||
json_feed = json_feed.format(title = "Releases", items = ", ".join(items))
|
json_feed = json_feed.format(title = "Releases", items = ", ".join(items))
|
||||||
print(json_feed)
|
print(json_feed)
|
@ -26,6 +26,10 @@ FormStandardFeedDetails::FormStandardFeedDetails(ServiceRoot* service_root, Root
|
|||||||
|
|
||||||
connect(m_standardFeedDetails->m_ui.m_btnFetchMetadata, &QPushButton::clicked, this, &FormStandardFeedDetails::guessFeed);
|
connect(m_standardFeedDetails->m_ui.m_btnFetchMetadata, &QPushButton::clicked, this, &FormStandardFeedDetails::guessFeed);
|
||||||
connect(m_standardFeedDetails->m_actionFetchIcon, &QAction::triggered, this, &FormStandardFeedDetails::guessIconOnly);
|
connect(m_standardFeedDetails->m_actionFetchIcon, &QAction::triggered, this, &FormStandardFeedDetails::guessIconOnly);
|
||||||
|
connect(m_standardFeedDetails->m_ui.m_txtTitle->lineEdit(), &QLineEdit::textChanged,
|
||||||
|
this, &FormStandardFeedDetails::onTitleChanged);
|
||||||
|
|
||||||
|
onTitleChanged(m_standardFeedDetails->m_ui.m_txtTitle->lineEdit()->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormStandardFeedDetails::guessFeed() {
|
void FormStandardFeedDetails::guessFeed() {
|
||||||
@ -44,6 +48,10 @@ void FormStandardFeedDetails::guessIconOnly() {
|
|||||||
m_authDetails->m_txtPassword->lineEdit()->text());
|
m_authDetails->m_txtPassword->lineEdit()->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FormStandardFeedDetails::onTitleChanged(const QString& title) {
|
||||||
|
m_ui->m_buttonBox->button(QDialogButtonBox::StandardButton::Ok)->setEnabled(!title.simplified().isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
void FormStandardFeedDetails::apply() {
|
void FormStandardFeedDetails::apply() {
|
||||||
FormFeedDetails::apply();
|
FormFeedDetails::apply();
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ class FormStandardFeedDetails : public FormFeedDetails {
|
|||||||
private slots:
|
private slots:
|
||||||
void guessFeed();
|
void guessFeed();
|
||||||
void guessIconOnly();
|
void guessIconOnly();
|
||||||
|
void onTitleChanged(const QString& title);
|
||||||
|
|
||||||
virtual void apply();
|
virtual void apply();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user