Skip to content

Commit

Permalink
Goreport card added.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnny-debt committed Jun 26, 2018
1 parent fc5add7 commit 9e22b22
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Instascrap

[![Build Status](https://travis-ci.org/johnny-debt/instascrap.svg?branch=master)](https://travis-ci.org/johnny-debt/instascrap) [![Coverage Status](https://coveralls.io/repos/github/johnny-debt/instascrap/badge.svg?branch=t1-add-coverals-integration)](https://coveralls.io/github/johnny-debt/instascrap?branch=t1-add-coverals-integration)
[![Build Status](https://travis-ci.org/johnny-debt/instascrap.svg?branch=master)](https://travis-ci.org/johnny-debt/instascrap)
[![Coverage Status](https://coveralls.io/repos/github/johnny-debt/instascrap/badge.svg?branch=t1-add-coverals-integration)](https://coveralls.io/github/johnny-debt/instascrap?branch=t1-add-coverals-integration)
[![Go Report Card](https://goreportcard.com/badge/github.com/johnny-debt/instascrap)](https://goreportcard.com/badge/github.com/johnny-debt/instascrap)

Simple and reliable Instagram scrapper for
Simple and reliable Instagram scrapper for educational purposes.
2 changes: 1 addition & 1 deletion account.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ package instascrap
type Account struct {
ID string
Username string
}
}
2 changes: 1 addition & 1 deletion instascrap_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package instascrap

import (
"io/ioutil"
"os"
"path/filepath"
"io/ioutil"
)

func getTestDataPath() string {
Expand Down
8 changes: 4 additions & 4 deletions mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ func getFromHashtagPage(data []byte) ([]Media, error) {
EdgeHashtagToMedia struct {
Edges []struct {
Node struct {
ID string `json:"id"`
Shortcode string `json:"shortcode"`
Owner account `json:"owner"`
ID string `json:"id"`
Shortcode string `json:"shortcode"`
Owner account `json:"owner"`
EdgeMediaToCaption struct {
Edges []struct {
Node struct {
Expand Down Expand Up @@ -58,4 +58,4 @@ func getFromHashtagPage(data []byte) ([]Media, error) {
}

return medias, nil
}
}
6 changes: 3 additions & 3 deletions mapping_test.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package instascrap

import (
"testing"
"github.com/stretchr/testify/assert"
"testing"
)

func TestGetMediasFromHashtagPage(t *testing.T) {
func TestGetMediasFromHashtagPage(t *testing.T) {
json := ReadTestDataFile("test-01-get-medias-from-hashtag-page.json")
medias, err := getFromHashtagPage(json)
assert.Nil(t, err, "Error is unexpected")
// We are expecting exactly 63 medias from the given JSON response
assert.Len(t, medias, 63, "Medias count mismatch")
}
}
4 changes: 2 additions & 2 deletions utils.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package instascrap

import (
"net/http"
"errors"
"io/ioutil"
"net/http"
)

func getDataFromURL(url string) ([]byte, error) {
Expand All @@ -14,7 +14,7 @@ func getDataFromURL(url string) ([]byte, error) {
}

if resp.StatusCode != 200 {
return nil, errors.New( "statusCode != 200")
return nil, errors.New("statusCode != 200")
}
defer resp.Body.Close()

Expand Down

0 comments on commit 9e22b22

Please sign in to comment.