~ghost08/ratt

ffb71178dd7a9dc64890423f9edd9b7a42efbe98 — VladimĂ­r Magyar 7 months ago 289a45b
fix: apnews.lua
3 files changed, 25 insertions(+), 13 deletions(-)

M confs/apnews.lua
M go.mod
M go.sum
M confs/apnews.lua => confs/apnews.lua +16 -10
@@ 1,24 1,30 @@
--apnews.com
ratt.add(
	"https://apnews.com/hub/*",
	"https://apnews.com/*",
	{
		httpsettings = {
			useragent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.72 Safari/537.36",
			useragent =
			"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.72 Safari/537.36",
		},
		feed = {
			title = "head title"
		},
		item = {
			container = ".FeedCard:not(.HubPeek)",
			title = ".-cardHeading",
			link = function(sel, _)
				local l = sel:find("a[data-key=card-headline]")
				return "https://apnews.com" .. l:attr("href")
			container = ".PageList-items-item",
			title = ".PagePromoContentIcons-text",
			link = ".PagePromo-title a",
			linkattr = "href",
			created = function(sel, _)
				local ts = tonumber(sel:find("bsp-timestamp"):attr("data-timestamp"))
				if ts == nil then
					return os.date("%Y-%m-%dT%H:%M:%SZ")
				end
				return os.date("%Y-%m-%dT%H:%M:%SZ", tonumber(ts) / 1000)
			end,
			created = "span.Timestamp",
			createdattr = "data-source",
			createdformat = "2006-01-02T15:04:05Z",
			description = "div.content p, span",
			description = ".PagePromo-title,.PagePromo-description",
			image = "img",
			imageattr = "src",
		}
	}
)

M go.mod => go.mod +3 -3
@@ 4,16 4,16 @@ go 1.21

require (
	github.com/PuerkitoBio/goquery v1.8.1
	github.com/alecthomas/kong v0.8.0
	github.com/alecthomas/kong v0.8.1
	github.com/gorilla/feeds v1.1.1
	github.com/itchyny/gojq v0.12.13
	github.com/yuin/gopher-lua v1.1.0
	golang.org/x/sync v0.3.0
	golang.org/x/sync v0.4.0
)

require (
	github.com/andybalholm/cascadia v1.3.2 // indirect
	github.com/itchyny/timefmt-go v0.1.5 // indirect
	github.com/kr/pretty v0.2.1 // indirect
	golang.org/x/net v0.15.0 // indirect
	golang.org/x/net v0.17.0 // indirect
)

M go.sum => go.sum +6 -0
@@ 7,6 7,8 @@ github.com/alecthomas/kong v0.7.1 h1:azoTh0IOfwlAX3qN9sHWTxACE2oV8Bg2gAwBsMwDQY4
github.com/alecthomas/kong v0.7.1/go.mod h1:n1iCIO2xS46oE8ZfYCNDqdR0b0wZNrXAIAqro/2132U=
github.com/alecthomas/kong v0.8.0 h1:ryDCzutfIqJPnNn0omnrgHLbAggDQM2VWHikE1xqK7s=
github.com/alecthomas/kong v0.8.0/go.mod h1:n1iCIO2xS46oE8ZfYCNDqdR0b0wZNrXAIAqro/2132U=
github.com/alecthomas/kong v0.8.1 h1:acZdn3m4lLRobeh3Zi2S2EpnXTd1mOL6U7xVml+vfkY=
github.com/alecthomas/kong v0.8.1/go.mod h1:n1iCIO2xS46oE8ZfYCNDqdR0b0wZNrXAIAqro/2132U=
github.com/alecthomas/repr v0.1.0 h1:ENn2e1+J3k09gyj2shc0dHr/yjaWSHRlrJ4DPMevDqE=
github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c=
github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA=


@@ 44,12 46,16 @@ golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8=
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ=
golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=