Compare commits
No commits in common. "ed796e6d7f1d87b4680817d5fd13e8d93b8e6cb3" and "395280a3639855b8294d8e96035edb52e37d6dcf" have entirely different histories.
ed796e6d7f
...
395280a363
@ -65,7 +65,6 @@ func fetch(u string) (r rss2.Item) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
dom, err := goquery.NewDocumentFromReader(res.Body)
|
dom, err := goquery.NewDocumentFromReader(res.Body)
|
||||||
defer res.Body.Close()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -105,7 +104,6 @@ func downAndSendMail(doc *goquery.Document, title string) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var fn []func()
|
|
||||||
for _, ss := range []string{".bbcle-download-extension-pdf", ".bbcle-download-extension-mp3"} {
|
for _, ss := range []string{".bbcle-download-extension-pdf", ".bbcle-download-extension-mp3"} {
|
||||||
uu, ok := doc.Find(ss).Attr("href")
|
uu, ok := doc.Find(ss).Attr("href")
|
||||||
if ok {
|
if ok {
|
||||||
@ -118,10 +116,6 @@ func downAndSendMail(doc *goquery.Document, title string) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
fn = append(fn, func() {
|
|
||||||
response.Body.Close()
|
|
||||||
file.Close()
|
|
||||||
})
|
|
||||||
_, err = io.Copy(file, response.Body)
|
_, err = io.Copy(file, response.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
@ -129,11 +123,6 @@ func downAndSendMail(doc *goquery.Document, title string) {
|
|||||||
mm.f = append(mm.f, name)
|
mm.f = append(mm.f, name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
defer func() {
|
|
||||||
for _, f := range fn {
|
|
||||||
f()
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
if len(mm.f) < 1 {
|
if len(mm.f) < 1 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,14 @@ func SendMail(subject string, content string, files ...string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmd := exec.Command(cm, v...)
|
cmd := exec.Command(cm, v...)
|
||||||
|
file, err := os.OpenFile("run.sh", os.O_CREATE|os.O_APPEND, 0755)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
_, err = file.WriteString(cmd.String())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
output, err := cmd.CombinedOutput()
|
output, err := cmd.CombinedOutput()
|
||||||
log.Println(string(output))
|
log.Println(string(output))
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user