Add GUIDs and date parsing error handling on JTSB feeds

This commit is contained in:
Lucidiot 2021-02-22 22:03:42 +01:00
parent f922078daf
commit adee9e05f9
Signed by: lucidiot
GPG Key ID: 3358C1CA6906FB8D
6 changed files with 55 additions and 16 deletions

View File

@ -33,7 +33,13 @@ import "./helpers" as helpers;
+ .children[6].children[0].text
),
"link": (.children[-1].children[0].href|helpers::urlresolve("http://www.mlit.go.jp/jtsb/")),
"pubDate": (try (.children[1].children[0].text | strptime("%Y.%m.%d") | mktime | strftime("%a, %d %b %Y %T %z")))
"guid": (.children[-1].children[0].href|helpers::urlresolve("http://www.mlit.go.jp/jtsb/")),
"pubDate": (try (
.children[1].children[0].text
| strptime("%Y.%m.%d")
| mktime
| strftime("%a, %d %b %Y %T %z")
) catch [])
}]
}
}

View File

@ -27,7 +27,13 @@ import "./helpers" as helpers;
+ .children[5].children[0].text
),
"link": (.children[-1].children[0].href|helpers::urlresolve("http://www.mlit.go.jp/jtsb/")),
"pubDate": (try (.children[1].children[0].text | strptime("%Y.%m.%d") | mktime | strftime("%a, %d %b %Y %T %z")))
"guid": (.children[-1].children[0].href|helpers::urlresolve("http://www.mlit.go.jp/jtsb/")),
"pubDate": (try (
.children[1].children[0].text
| strptime("%Y.%m.%d")
| mktime
| strftime("%a, %d %b %Y %T %z")
) catch [])
}]
}
}

View File

@ -27,7 +27,13 @@ import "./helpers" as helpers;
+ .children[5].children[0].text
),
"link": (.children[-1].children[0].href|helpers::urlresolve("http://www.mlit.go.jp/jtsb/")),
"pubDate": (try (.children[1].children[0].text | strptime("%Y.%m.%d") | mktime | strftime("%a, %d %b %Y %T %z")))
"guid": (.children[-1].children[0].href|helpers::urlresolve("http://www.mlit.go.jp/jtsb/")),
"pubDate": (try (
.children[1].children[0].text
| strptime("%Y.%m.%d")
| mktime
| strftime("%a, %d %b %Y %T %z")
) catch [])
}]
}
}

View File

@ -22,16 +22,23 @@
),
"description": (
.children[4].text
+ " "
+ " "
+ .children[3].text
+ .children[3].children[0].text
+ " "
+ " "
+ .children[2].text
+ " "
+ " "
+ .children[1].text
),
"link": .children[5].children[2].href,
"pubDate": (try (.children[5].text | sub("[^0-9]"; ""; "g") | strptime("%Y%m%d") | mktime | strftime("%a, %d %b %Y %T %z")))
"link": .children[5].children[2].href,
"guid": .children[5].children[2].href,
"pubDate": (try (
.children[5].text
| sub("[^0-9]"; ""; "g")
| strptime("%Y%m%d")
| mktime
| strftime("%a, %d %b %Y %T %z")
) catch [])
}]
}
}

View File

@ -22,13 +22,20 @@
),
"description": (
.children[3].text
+ " "
+ " "
+ .children[2].text
+ " "
+ " "
+ .children[1].text
),
"link": .children[4].children[2].href,
"pubDate": (try (.children[4].text | sub("[^0-9]"; ""; "g") | strptime("%Y%m%d") | mktime | strftime("%a, %d %b %Y %T %z")))
"link": .children[4].children[2].href,
"guid": .children[4].children[2].href,
"pubDate": (try (
.children[4].text
| sub("[^0-9]"; ""; "g")
| strptime("%Y%m%d")
| mktime
| strftime("%a, %d %b %Y %T %z")
) catch [])
}]
}
}

View File

@ -22,14 +22,21 @@
),
"description": (
.children[3].text
+ " "
+ " "
+ .children[2].text
+ .children[2].children[0].text
+ " "
+ " "
+ .children[1].text
),
"link": .children[4].children[2].href,
"pubDate": (try (.children[4].text | sub("[^0-9]"; ""; "g") | strptime("%Y%m%d") | mktime | strftime("%a, %d %b %Y %T %z")))
"link": .children[4].children[2].href,
"guid": .children[4].children[2].href,
"pubDate": (try (
.children[4].text
| sub("[^0-9]"; ""; "g")
| strptime("%Y%m%d")
| mktime
| strftime("%a, %d %b %Y %T %z")
) catch [])
}]
}
}