Skip to content

Commit c29869a

Browse files
committed
Fixed hard-coded user names
1 parent 65e838c commit c29869a

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

task/collector.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ func (task *Collector) Precheck() error {
5555
return err
5656
} else {
5757
task.outputDir = path
58+
log.Println("New output path saved:", task.outputDir)
5859
}
59-
log.Println("New output path saved:", task.outputDir)
6060

6161
// Check user existence.
6262
exists := true
@@ -237,7 +237,7 @@ func (task *Collector) crawlBookListDispatcher() error {
237237

238238
func (task *Collector) crawlBookLists(totalItems int, tag string, urlAction string) error {
239239
const pageStep = 15
240-
urlTemplate := fmt.Sprintf("https://book.douban.com/people/mewcatcher/%s?start=%%d&sort=time&rating=all&filter=all&mode=grid", urlAction)
240+
urlTemplate := fmt.Sprintf("https://book.douban.com/people/%s/%s?start=%%d&sort=time&rating=all&filter=all&mode=grid", task.user, urlAction)
241241
return task.crawlItemLists(proto.Category_book, totalItems, pageStep, tag, urlTemplate)
242242
}
243243

@@ -292,7 +292,7 @@ func (task *Collector) crawlMovieListDispatcher() error {
292292

293293
func (task *Collector) crawlMovieLists(totalItems int, tag string, urlAction string) error {
294294
const pageStep = 15
295-
urlTemplate := fmt.Sprintf("https://movie.douban.com/people/mewcatcher/%s?start=%%d&sort=time&rating=all&filter=all&mode=grid", urlAction)
295+
urlTemplate := fmt.Sprintf("https://movie.douban.com/people/%s/%s?start=%%d&sort=time&rating=all&filter=all&mode=grid", task.user, urlAction)
296296
return task.crawlItemLists(proto.Category_movie, totalItems, pageStep, tag, urlTemplate)
297297
}
298298

@@ -347,7 +347,7 @@ func (task *Collector) crawlGameListDispatcher() error {
347347

348348
func (task *Collector) crawlGameLists(totalItems int, tag string, urlAction string) error {
349349
const pageStep = 15
350-
urlTemplate := fmt.Sprintf("https://www.douban.com/people/mewcatcher/games?action=%s&start=%%d", urlAction)
350+
urlTemplate := fmt.Sprintf("https://www.douban.com/people/%s/games?action=%s&start=%%d", task.user, urlAction)
351351
return task.crawlItemLists(proto.Category_game, totalItems, pageStep, tag, urlTemplate)
352352
}
353353

@@ -401,8 +401,7 @@ func (task *Collector) crawlMusicListDispatcher() error {
401401

402402
func (task *Collector) crawlMusicLists(totalItems int, tag string, urlAction string) error {
403403
const pageStep = 15
404-
// FIXME: user name.
405-
urlTemplate := fmt.Sprintf("https://music.douban.com/people/mewcatcher/%s?start=%%d&sort=time&rating=all&filter=all&mode=grid", urlAction)
404+
urlTemplate := fmt.Sprintf("https://music.douban.com/people/%s/%s?start=%%d&sort=time&rating=all&filter=all&mode=grid", task.user, urlAction)
406405
return task.crawlItemLists(proto.Category_music, totalItems, pageStep, tag, urlTemplate)
407406
}
408407

0 commit comments

Comments
 (0)