73 lines
2.6 KiB
Go
73 lines
2.6 KiB
Go
package main
|
|
|
|
import (
|
|
"regexp"
|
|
|
|
"github.com/chromedp/cdproto/cdp"
|
|
"github.com/robfig/cron/v3"
|
|
)
|
|
|
|
const (
|
|
emailField = `//*[@id="m_login_email"]`
|
|
passwordField = `//*[@id="m_login_password"]`
|
|
)
|
|
|
|
// xPath constants
|
|
const (
|
|
xPathArticle string = `(//*/article[contains(concat(" ", normalize-space(@class)," "), " _55wo ") and contains(concat(" ", normalize-space(@class)," "), " _5rgr ")])[1]`
|
|
xPathArticleContent string = xPathArticle + `/div/div[contains(concat(" ", normalize-space(@class)," "), " _5rgt ") and contains(concat(" ", normalize-space(@class)," "), " _5nk5 ")]/span`
|
|
xPathImageURL string = xPathArticle + `/div/div[2]/div[1]/a/div/div/i`
|
|
xPathImageURL2 string = xPathArticle + `/div/div[2]/section/div/i`
|
|
xPathImageURL3 string = xPathArticle + `/div/div[2]/section/div/div/i` // Video Preview
|
|
xPathGiftURL string = xPathArticle + `/div/div[2]/section/a`
|
|
xPathPostingURL string = xPathArticle + `/div/header/div[2]/div/div/div[1]/div/a`
|
|
)
|
|
|
|
// internal URL constants
|
|
const (
|
|
fbPageURL string = "https://www.facebook.com/herowarsgame/"
|
|
// fbGameURL for search on expaned urls
|
|
fbGameURL string = "apps.facebook.com/mobaheroes"
|
|
)
|
|
|
|
// Constants for title of the Postings
|
|
const (
|
|
TitleFreeTitanArtifact string = "FREE Titan Artifact"
|
|
TitleFreeSilverCaskets string = "FREE Silver Caskets"
|
|
TitleFreeSoulStones string = "FREE Soul Stones"
|
|
TitleFreeSkinStones string = "FREE Skin Stones"
|
|
TitleActionKeepTheAmount string = "Keep the amount"
|
|
TitleFreeWinterfestBaubles string = "Winterfest Baubles"
|
|
TitleFreeTopFanPackage string = "Top Fan Gift"
|
|
TitleFreeEnergyForFee string = "ENERGY FOR FREE"
|
|
TitleWinterfestRankingRewards string = "Winterfest ranking rewards"
|
|
)
|
|
|
|
// Constants for all search for title of the Postings
|
|
const (
|
|
SearchFreeTitanArtifact string = "FREE Titan Artifact"
|
|
SearchFreeSilverCaskets string = "FREE Silver Caskets"
|
|
SearchFreeSoulStones string = "Soul Stones"
|
|
SearchFreeSkinStones string = "Skin Stones"
|
|
SearchActionKeepTheAmount string = "Keep the amount"
|
|
SearchFreeWinterfestBaubles string = "Winterfest Baubles"
|
|
SearchFreeTopFanPackage string = "Top Fan"
|
|
SearchFreeEnergyForFee string = "ENERGY FOR FREE"
|
|
SearchWinterfestRankingRewards string = "Winterfest ranking rewards"
|
|
)
|
|
|
|
var (
|
|
headers = map[string]interface{}{
|
|
"Accept-Language": "de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7",
|
|
}
|
|
nodes []*cdp.Node
|
|
|
|
dataFT *DataFT
|
|
|
|
lastUpdatePosted string
|
|
regexStyleImage = regexp.MustCompile(`(?m)url\((.*)\);`)
|
|
|
|
// cronJob the Cronjob data
|
|
cronJob *cron.Cron
|
|
)
|