Compare commits
2 Commits
f571ac6278
...
09df2285f7
Author | SHA1 | Date | |
---|---|---|---|
09df2285f7 | |||
2f7d3a5cc0 |
@ -1,11 +1,10 @@
|
||||
Class {
|
||||
#name : 'BaselineOfInstagramPharo',
|
||||
#superclass : 'BaselineOf',
|
||||
#category : 'BaselineOfInstagramPharo',
|
||||
#package : 'BaselineOfInstagramPharo'
|
||||
#name : #BaselineOfInstagramPharo,
|
||||
#superclass : #BaselineOf,
|
||||
#category : #BaselineOfInstagramPharo
|
||||
}
|
||||
|
||||
{ #category : 'baselines' }
|
||||
{ #category : #baselines }
|
||||
BaselineOfInstagramPharo >> baseline: spec [
|
||||
|
||||
<baseline>
|
||||
@ -13,6 +12,8 @@ BaselineOfInstagramPharo >> baseline: spec [
|
||||
for: #common
|
||||
do: [ spec
|
||||
package: 'Instagram';
|
||||
package: 'ExtEnvi';
|
||||
package: 'Instagram' with: [ spec requires: #('ExtEnvi') ];
|
||||
package: 'Instagram-Tests' with: [ spec requires: #('Instagram') ];
|
||||
group: 'default' with: #('core' 'tests');
|
||||
group: 'core' with: #('Instagram');
|
||||
|
@ -1 +1 @@
|
||||
Package { #name : 'BaselineOfInstagramPharo' }
|
||||
Package { #name : #BaselineOfInstagramPharo }
|
||||
|
56
Instagram/InstagramDownloader.class.st
Normal file
56
Instagram/InstagramDownloader.class.st
Normal file
@ -0,0 +1,56 @@
|
||||
Class {
|
||||
#name : #InstagramDownloader,
|
||||
#superclass : #Object,
|
||||
#instVars : [
|
||||
'bin',
|
||||
'profiles'
|
||||
],
|
||||
#category : #Instagram
|
||||
}
|
||||
|
||||
{ #category : #'as yet unclassified' }
|
||||
InstagramDownloader >> downloadProfile: anInstProfileName [
|
||||
| profiles |
|
||||
profiles := (FileLocator documents / 'InstagramDownloader' / 'Profiles') ensureCreateDirectory.
|
||||
^ GtSubprocessWithInMemoryOutput new
|
||||
workingDirectory: profiles;
|
||||
command: bin fullName;
|
||||
arguments: {anInstProfileName.
|
||||
'--no-videos'.
|
||||
'--no-compress-json'};
|
||||
runAndWait;
|
||||
stdout
|
||||
]
|
||||
|
||||
{ #category : #'as yet unclassified' }
|
||||
InstagramDownloader >> initialize [
|
||||
super initialize.
|
||||
]
|
||||
|
||||
{ #category : #'as yet unclassified' }
|
||||
InstagramDownloader >> installDefault [
|
||||
| py doc location |
|
||||
doc := FileLocator documents.
|
||||
location := (doc / 'InstagramDownloader') ensureCreateDirectory.
|
||||
py := PyEnv new.
|
||||
py createEnv: 'InstagramDownloader' in: doc.
|
||||
py install: 'instaloader' in: 'InstagramDownloader'.
|
||||
bin := location / 'bin' / 'instaloader'.
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
InstagramDownloader >> loadDefault [
|
||||
| temp |
|
||||
temp := FileLocator documents / 'InstagramDownloader'.
|
||||
bin := temp / 'bin' / 'instaloader'.
|
||||
profiles := temp / 'Profiles'
|
||||
]
|
||||
|
||||
{ #category : #'as yet unclassified' }
|
||||
InstagramDownloader >> profiles [
|
||||
| location |
|
||||
profiles
|
||||
ifNil: [ location := bin parent parent / 'Profiles'.
|
||||
location exists ifFalse: [ ^ profiles := location ensureCreateDirectory ] ].
|
||||
^ profiles
|
||||
]
|
@ -4,17 +4,16 @@ I manage instagram URLs information.
|
||||
InstagramUrl newURL: 'https://instagram.com/restOfURL'
|
||||
"
|
||||
Class {
|
||||
#name : 'InstagramUrl',
|
||||
#superclass : 'Object',
|
||||
#name : #InstagramUrl,
|
||||
#superclass : #Object,
|
||||
#instVars : [
|
||||
'url',
|
||||
'type'
|
||||
],
|
||||
#category : 'Instagram',
|
||||
#package : 'Instagram'
|
||||
#category : 'Instagram'
|
||||
}
|
||||
|
||||
{ #category : 'instance creation' }
|
||||
{ #category : #'instance creation' }
|
||||
InstagramUrl class >> newURL: url [
|
||||
| instance |
|
||||
instance := self new.
|
||||
@ -23,7 +22,7 @@ InstagramUrl class >> newURL: url [
|
||||
^ instance
|
||||
]
|
||||
|
||||
{ #category : 'initialization' }
|
||||
{ #category : #initialization }
|
||||
InstagramUrl >> initialize [
|
||||
|
||||
super initialize.
|
||||
@ -33,7 +32,7 @@ InstagramUrl >> initialize [
|
||||
|
||||
]
|
||||
|
||||
{ #category : 'testing' }
|
||||
{ #category : #testing }
|
||||
InstagramUrl >> isRootUrl [
|
||||
|
||||
| segments |
|
||||
@ -45,7 +44,7 @@ InstagramUrl >> isRootUrl [
|
||||
^ true
|
||||
]
|
||||
|
||||
{ #category : 'testing' }
|
||||
{ #category : #testing }
|
||||
InstagramUrl >> isUserUrl [
|
||||
|
||||
| segments |
|
||||
@ -57,12 +56,12 @@ InstagramUrl >> isUserUrl [
|
||||
^ true
|
||||
]
|
||||
|
||||
{ #category : 'opening' }
|
||||
{ #category : #opening }
|
||||
InstagramUrl >> openWithoutTracking [
|
||||
WebBrowser openOn: self urlWithoutTracking
|
||||
]
|
||||
|
||||
{ #category : 'initialization' }
|
||||
{ #category : #initialization }
|
||||
InstagramUrl >> setTypeByUrl [
|
||||
|
||||
self isRootUrl ifTrue: [ type := 'root'. ^ self ].
|
||||
@ -71,13 +70,13 @@ InstagramUrl >> setTypeByUrl [
|
||||
^ self
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
InstagramUrl >> type [
|
||||
|
||||
^ type
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
InstagramUrl >> type: aType [
|
||||
|
||||
(self urlTypes includes: aType) ifTrue: [
|
||||
@ -88,13 +87,13 @@ InstagramUrl >> type: aType [
|
||||
^ self setTypeByUrl
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
InstagramUrl >> url [
|
||||
|
||||
^ url ifNil: [ url := 'https://instagram.com/' asUrl ]
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
InstagramUrl >> url: anURLString [
|
||||
|
||||
| urlCheck |
|
||||
@ -109,14 +108,14 @@ InstagramUrl >> url: anURLString [
|
||||
url := urlCheck
|
||||
]
|
||||
|
||||
{ #category : 'accessing - data' }
|
||||
{ #category : #'accessing - data' }
|
||||
InstagramUrl >> urlTypes [
|
||||
"I have the collection of correct types."
|
||||
|
||||
^ { 'root' . 'user' }
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
InstagramUrl >> urlWithoutTracking [
|
||||
^ self url queryRemoveAll; asStringOrText
|
||||
]
|
||||
|
@ -1 +1 @@
|
||||
Package { #name : 'Instagram' }
|
||||
Package { #name : #Instagram }
|
||||
|
Loading…
Reference in New Issue
Block a user