mirror of
https://codeberg.org/VnPower/PixivFE
synced 2024-12-06 19:16:23 +01:00
Feature: date query for ranking page #20
This commit is contained in:
@@ -6,7 +6,7 @@ const (
|
||||
ArtworkRelatedURL = "https://www.pixiv.net/ajax/illust/%s/recommend/init?limit=%d"
|
||||
ArtworkCommentsURL = "https://www.pixiv.net/ajax/illusts/comments/roots?illust_id=%s&limit=100"
|
||||
ArtworkNewestURL = "https://www.pixiv.net/ajax/illust/new?limit=30&type=%s&r18=%s&lastId=%s"
|
||||
ArtworkRankingURL = "https://www.pixiv.net/ranking.php?format=json&mode=%s&content=%s&p=%s"
|
||||
ArtworkRankingURL = "https://www.pixiv.net/ranking.php?format=json&mode=%s&content=%s&date=%s&p=%s"
|
||||
ArtworkDiscoveryURL = "https://www.pixiv.net/ajax/discovery/artworks?mode=%s&limit=%d"
|
||||
SearchTagURL = "https://www.pixiv.net/ajax/search/tags/%s"
|
||||
SearchArtworksURL = "https://www.pixiv.net/ajax/search/%s/%s?order=%s&mode=%s&p=%s"
|
||||
|
||||
+2
-2
@@ -37,11 +37,11 @@ func (p *PixivClient) GetNewestArtworks(worktype string, r18 string) ([]models.I
|
||||
return newWorks, nil
|
||||
}
|
||||
|
||||
func (p *PixivClient) GetRanking(mode string, content string, page string) (models.RankingResponse, error) {
|
||||
func (p *PixivClient) GetRanking(mode string, content string, date string, page string) (models.RankingResponse, error) {
|
||||
// Ranking data is formatted differently
|
||||
var pr models.RankingResponse
|
||||
|
||||
url := fmt.Sprintf(ArtworkRankingURL, mode, content, page)
|
||||
url := fmt.Sprintf(ArtworkRankingURL, mode, content, date, page)
|
||||
|
||||
s, err := p.TextRequest(url)
|
||||
|
||||
|
||||
+3
-2
@@ -128,14 +128,15 @@ func ranking_page(c *fiber.Ctx) error {
|
||||
image_proxy = &configs.ProxyServer
|
||||
}
|
||||
|
||||
queries := make(map[string]string, 3)
|
||||
queries := make(map[string]string, 4)
|
||||
queries["Mode"] = c.Query("mode", "daily")
|
||||
queries["Content"] = c.Query("content", "all")
|
||||
queries["Date"] = c.Query("date", "")
|
||||
|
||||
page := c.Query("page", "1")
|
||||
pageInt, _ := strconv.Atoi(page)
|
||||
|
||||
response, err := PC.GetRanking(queries["Mode"], queries["Content"], page)
|
||||
response, err := PC.GetRanking(queries["Mode"], queries["Content"], queries["Date"], page)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user