-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobjects_test.go
19 lines (15 loc) · 9.05 KB
/
objects_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package gnhentai
import (
"encoding/json"
"testing"
)
func TestDoujinshi_UnmarshalJSON(t *testing.T) {
data := `{"id":177013,"media_id":"987560","title":{"english":"[ShindoLA] METAMORPHOSIS (Complete) [English]","japanese":"","pretty":"METAMORPHOSIS"},"images":{"pages":[{"t":"j","w":1275,"h":1844},{"t":"j","w":1268,"h":1844},{"t":"j","w":1274,"h":1843},{"t":"j","w":1275,"h":1845},{"t":"j","w":1280,"h":1827},{"t":"j","w":1280,"h":1834},{"t":"j","w":1280,"h":1837},{"t":"j","w":1280,"h":1834},{"t":"j","w":1280,"h":1818},{"t":"j","w":1280,"h":1835},{"t":"j","w":1280,"h":1827},{"t":"j","w":1280,"h":1840},{"t":"j","w":1280,"h":1818},{"t":"j","w":1280,"h":911},{"t":"j","w":1273,"h":1843},{"t":"j","w":1280,"h":1835},{"t":"j","w":1276,"h":1847},{"t":"j","w":1280,"h":1822},{"t":"j","w":1280,"h":918},{"t":"j","w":1271,"h":1841},{"t":"j","w":1280,"h":1841},{"t":"j","w":1275,"h":1840},{"t":"j","w":1280,"h":1821},{"t":"j","w":1280,"h":1840},{"t":"j","w":1279,"h":1842},{"t":"j","w":1280,"h":1832},{"t":"j","w":928,"h":1331},{"t":"j","w":929,"h":1331},{"t":"j","w":931,"h":1331},{"t":"j","w":931,"h":1331},{"t":"j","w":931,"h":1331},{"t":"j","w":930,"h":1331},{"t":"j","w":930,"h":1331},{"t":"j","w":932,"h":1331},{"t":"j","w":928,"h":1331},{"t":"j","w":929,"h":1331},{"t":"j","w":930,"h":1331},{"t":"j","w":933,"h":1331},{"t":"j","w":928,"h":1331},{"t":"j","w":931,"h":1331},{"t":"j","w":933,"h":1331},{"t":"j","w":933,"h":1331},{"t":"j","w":933,"h":1331},{"t":"j","w":933,"h":1331},{"t":"j","w":935,"h":1331},{"t":"j","w":931,"h":1331},{"t":"j","w":931,"h":1331},{"t":"j","w":934,"h":1331},{"t":"j","w":929,"h":1331},{"t":"j","w":950,"h":680},{"t":"j","w":931,"h":1331},{"t":"j","w":931,"h":1331},{"t":"j","w":929,"h":1331},{"t":"j","w":931,"h":1331},{"t":"j","w":931,"h":1331},{"t":"j","w":891,"h":1300},{"t":"j","w":891,"h":1300},{"t":"j","w":890,"h":1300},{"t":"j","w":890,"h":1300},{"t":"j","w":891,"h":1300},{"t":"j","w":891,"h":1300},{"t":"j","w":891,"h":1300},{"t":"j","w":890,"h":1300},{"t":"j","w":892,"h":1300},{"t":"j","w":891,"h":1300},{"t":"j","w":890,"h":1300},{"t":"j","w":890,"h":1300},{"t":"j","w":891,"h":1300},{"t":"j","w":890,"h":1300},{"t":"j","w":889,"h":1300},{"t":"j","w":890,"h":1300},{"t":"j","w":889,"h":1300},{"t":"j","w":889,"h":1300},{"t":"j","w":891,"h":1300},{"t":"j","w":890,"h":1300},{"t":"j","w":890,"h":1300},{"t":"j","w":886,"h":1300},{"t":"j","w":890,"h":1300},{"t":"j","w":889,"h":1300},{"t":"j","w":891,"h":1300},{"t":"j","w":888,"h":1300},{"t":"j","w":888,"h":1300},{"t":"j","w":887,"h":1300},{"t":"j","w":887,"h":1300},{"t":"j","w":887,"h":1300},{"t":"j","w":861,"h":1250},{"t":"j","w":860,"h":1250},{"t":"j","w":862,"h":1250},{"t":"j","w":863,"h":1250},{"t":"j","w":860,"h":1250},{"t":"j","w":863,"h":1250},{"t":"j","w":862,"h":1250},{"t":"j","w":863,"h":1250},{"t":"j","w":863,"h":1250},{"t":"j","w":863,"h":1250},{"t":"j","w":863,"h":1250},{"t":"j","w":859,"h":1250},{"t":"j","w":860,"h":1250},{"t":"j","w":858,"h":1250},{"t":"j","w":861,"h":1250},{"t":"j","w":857,"h":1250},{"t":"j","w":863,"h":1250},{"t":"j","w":857,"h":1250},{"t":"j","w":862,"h":1250},{"t":"j","w":862,"h":1250},{"t":"j","w":862,"h":1250},{"t":"j","w":862,"h":1250},{"t":"j","w":869,"h":1250},{"t":"j","w":1280,"h":916},{"t":"j","w":876,"h":1250},{"t":"j","w":869,"h":1250},{"t":"j","w":872,"h":1250},{"t":"j","w":872,"h":1250},{"t":"j","w":871,"h":1250},{"t":"j","w":872,"h":1250},{"t":"j","w":871,"h":1250},{"t":"j","w":872,"h":1250},{"t":"j","w":873,"h":1250},{"t":"j","w":872,"h":1250},{"t":"j","w":872,"h":1250},{"t":"j","w":873,"h":1250},{"t":"j","w":873,"h":1250},{"t":"j","w":871,"h":1250},{"t":"j","w":873,"h":1250},{"t":"j","w":871,"h":1250},{"t":"j","w":872,"h":1250},{"t":"j","w":871,"h":1250},{"t":"j","w":873,"h":1250},{"t":"j","w":871,"h":1250},{"t":"j","w":872,"h":1250},{"t":"j","w":872,"h":1250},{"t":"j","w":868,"h":1250},{"t":"j","w":871,"h":1250},{"t":"j","w":870,"h":1250},{"t":"j","w":871,"h":1250},{"t":"j","w":872,"h":1250},{"t":"j","w":871,"h":1250},{"t":"j","w":872,"h":1250},{"t":"j","w":871,"h":1250},{"t":"j","w":871,"h":1250},{"t":"j","w":868,"h":1250},{"t":"j","w":872,"h":1250},{"t":"j","w":872,"h":1250},{"t":"j","w":869,"h":1250},{"t":"j","w":872,"h":1250},{"t":"j","w":871,"h":1250},{"t":"j","w":871,"h":1250},{"t":"j","w":1280,"h":913},{"t":"j","w":871,"h":1250},{"t":"j","w":886,"h":1232},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":886,"h":1233},{"t":"j","w":878,"h":1278},{"t":"j","w":876,"h":1278},{"t":"j","w":867,"h":1278},{"t":"j","w":866,"h":1278},{"t":"j","w":876,"h":1278},{"t":"j","w":876,"h":1278},{"t":"j","w":869,"h":1278},{"t":"j","w":864,"h":1278},{"t":"j","w":877,"h":1278},{"t":"j","w":864,"h":1278},{"t":"j","w":865,"h":1278},{"t":"j","w":865,"h":1278},{"t":"j","w":877,"h":1278},{"t":"j","w":876,"h":1278},{"t":"j","w":878,"h":1278},{"t":"j","w":877,"h":1278},{"t":"j","w":865,"h":1278},{"t":"j","w":863,"h":1278},{"t":"j","w":865,"h":1278},{"t":"j","w":866,"h":1278},{"t":"j","w":879,"h":1278},{"t":"j","w":876,"h":1278},{"t":"j","w":878,"h":1278},{"t":"j","w":879,"h":1278},{"t":"j","w":876,"h":1278},{"t":"j","w":876,"h":1278},{"t":"j","w":865,"h":1278},{"t":"j","w":866,"h":1278},{"t":"j","w":867,"h":1278},{"t":"j","w":865,"h":1278},{"t":"j","w":864,"h":1278},{"t":"j","w":864,"h":1278},{"t":"j","w":866,"h":1278},{"t":"j","w":876,"h":1278},{"t":"j","w":878,"h":1278},{"t":"j","w":865,"h":1278},{"t":"j","w":868,"h":1278},{"t":"j","w":865,"h":1278},{"t":"j","w":868,"h":1278},{"t":"j","w":866,"h":1278}],"cover":{"t":"j","w":350,"h":506},"thumbnail":{"t":"j","w":250,"h":362}},"scanlator":"","upload_date":1476793729,"tags":[{"id":3981,"type":"artist","name":"shindol","url":"/artist/shindol/","count":260},{"id":5820,"type":"tag","name":"piercing","url":"/tag/piercing/","count":4627},{"id":6343,"type":"tag","name":"pregnant","url":"/tag/pregnant/","count":8022},{"id":7256,"type":"tag","name":"mmf threesome","url":"/tag/mmf-threesome/","count":7978},{"id":7288,"type":"tag","name":"vomit","url":"/tag/vomit/","count":738},{"id":8010,"type":"tag","name":"group","url":"/tag/group/","count":63062},{"id":8739,"type":"tag","name":"story arc","url":"/tag/story-arc/","count":7450},{"id":10314,"type":"tag","name":"schoolgirl uniform","url":"/tag/schoolgirl-uniform/","count":49730},{"id":10542,"type":"tag","name":"snuff","url":"/tag/snuff/","count":1928},{"id":12227,"type":"language","name":"english","url":"/language/english/","count":59662},{"id":12695,"type":"tag","name":"prostitution","url":"/tag/prostitution/","count":4555},{"id":13720,"type":"tag","name":"nakadashi","url":"/tag/nakadashi/","count":33146},{"id":13722,"type":"tag","name":"moral degeneration","url":"/tag/moral-degeneration/","count":413},{"id":13989,"type":"tag","name":"ahegao","url":"/tag/ahegao/","count":24826},{"id":14283,"type":"tag","name":"anal","url":"/tag/anal/","count":55420},{"id":17249,"type":"language","name":"translated","url":"/language/translated/","count":89326},{"id":19018,"type":"tag","name":"dark skin","url":"/tag/dark-skin/","count":16904},{"id":20035,"type":"tag","name":"x-ray","url":"/tag/x-ray/","count":17423},{"id":21112,"type":"tag","name":"full body tattoo","url":"/tag/full-body-tattoo/","count":579},{"id":22079,"type":"tag","name":"drugs","url":"/tag/drugs/","count":5566},{"id":22942,"type":"tag","name":"incest","url":"/tag/incest/","count":24574},{"id":22945,"type":"tag","name":"double penetration","url":"/tag/double-penetration/","count":21543},{"id":24201,"type":"tag","name":"stockings","url":"/tag/stockings/","count":55436},{"id":25050,"type":"tag","name":"gyaru","url":"/tag/gyaru/","count":2486},{"id":27384,"type":"tag","name":"mind break","url":"/tag/mind-break/","count":11740},{"id":29182,"type":"tag","name":"blackmail","url":"/tag/blackmail/","count":3426},{"id":29224,"type":"tag","name":"impregnation","url":"/tag/impregnation/","count":12904},{"id":29859,"type":"tag","name":"blowjob","url":"/tag/blowjob/","count":29067},{"id":32996,"type":"tag","name":"deepthroat","url":"/tag/deepthroat/","count":2743},{"id":33173,"type":"category","name":"manga","url":"/category/manga/","count":67912},{"id":53449,"type":"tag","name":"already uploaded","url":"/tag/already-uploaded/","count":2017}],"num_pages":225,"num_favorites":24684}`
var d Doujinshi
err := json.Unmarshal([]byte(data), &d)
if err != nil {
t.Error(err)
return
}
t.Log(d.UploadDate.String())
}